DirectoryIndex app.php
RewriteEngine On
#RewriteCond %{HTTP_HOST} !^{target host}$ [NC]
#RewriteRule .* http://{target host}/$0 [L,R=301]
# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
# If the requested filename is home and it exists in cache, simply serve it.
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
RewriteRule (.*) cache/index.html [L]
# If the requested filename exists in cache, simply serve it.
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI} -f
RewriteRule (.*) cache/$1 [L]
# Rewrite all other queries to the front controller.
RewriteRule ^ app.php [L]