What does this Mod Rewrite do?
Can anybody tell me what this does?
RewriteRule .* .main.php [QSA,L]
From what I understand it will rewrite ANYTHING to main.php correct? But not so sure what the QSA,L does.
This is the whole .htaccess file, when I hit the main d开发者_运维百科irectory I get a 400 Bad Request error. Edit: Bad request went away when I added an ending slash in the browser to the root directory of this script.
RewriteEngine On
# Transfering to the main tranfer file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !\.css$
RewriteCond %{REQUEST_FILENAME} !\.js$
RewriteRule .* .main.php [QSA,L]
# nobody is allowed to access the access the INI file
<FilesMatch "\.inc.php$">
Order allow,deny
Deny from all
</FilesMatch>
QSA = Query String Append: append the existing query string to the re-written rule
L = Last Rule: last rule of the set, don't process any following RewriteRule
Check out the documentation for more.
Do you have a file that is named .main.php
? The dot prefix worries me. Your rules read that unless the request is an exists, symbolic link, or it has a CSS or JS extension it goes to .main.php
精彩评论