.htaccess

Created: 25.05.2018 | Updated: 31.08.2018

RewriteRule Flags

Documentation about Rewrite Rule Flags.

QSA: When the replacement URI contains a query string, the default behavior of RewriteRule is to discard the existing query string, and replace it with the newly generated one. Using the [QSA] flag causes the query strings to be combined.

FallbackResource

Typically the following construct is used to forward all requests to non-existing files to your front controller:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]

And here an option to pass all parameters over to index.php as well:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?appurl=$1 [QSA,L]

This configuration checks if the requested filename either exists or is a directory. If this is not the case, it will call the file index.php. The [L] means this is the last match that needs to be made and following rewrite-rules will be skipped.

Starting with Apache 2.2.16 this can be done with the fallback resource:

FallbackResource /index.php







You can view this page as reduced HTML version as well.