开发者

Implementing MediaWiki Short Url example.com/Main_Page while still giving access to robots.txt

开发者 https://www.devze.com 2023-02-11 20:56 出处:网络
For the following .htaccess how do I allow access to robots.txt? RewriteEngine On Rewri开发者_如何学PythonteCond %{HTTP_HOST} ^www\\.(.+)$ [NC]

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消