What does RewriteRule ^(.*)/$ ?path=$1 [QSA,L] mean in my .htaccess?
.htaccess, mod-rewrite, nginx, regex, url-rewriting
Solution
`RewriteCond % !-f` seems incorrect rule condition and is always evaluating to true.
This rule:
RewriteRule ^(.*)/$ ?path=$1 [QSA,L]
Is matching any URI with trailing slash and internally rewriting to `/?path=uri-without-slash`
So for ex: an URI `/foo/` will be rewritten to `/?path=foo`
- QSA - Query String Append
- L = Last rule
Reference: Apache mod_rewrite Introduction
UPDATE: Change that incorrect condition to:
# request is not for a file
RewriteCond %{REQUEST_FILENAME} !-f
# request is not for a directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ ?path=$1 [QSA,L]
Problem
I need to create rewrite in nginx as is done in my .htaccess and there are some lines which I don't completely understand. ``` DirectoryIndex index.php RewriteEngine on RewriteCond % !-f RewriteRule ^(.*)/$ ?path=$1 [QSA,L] ``` Can someone explain it to me?