Implementing MediaWiki Short Url example.com/Main_Page while still giving access to robots.txt
For the following .htaccess how do I allow access to robots.txt?
RewriteEngine On
Rewri开发者_如何学PythonteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^[^:]*\. - [L]
RewriteRule ^[^:]*\/ - [L]
RewriteRule ^/*$ /w/index.php?title=Main_Page [L,QSA]
RewriteRule ^(.+)$ /w/index.php?title=$1 [L,QSA]
Generally, with mod_rewrite, you will check if a file exists, and if it does, not go somewhere else.
After the initial RewriteCond, add
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Only if a file or directory does not exist by the name requested, does it continue on to the RewriteRule's.
精彩评论