【问题标题】:Implementing MediaWiki Short Url example.com/Main_Page while still giving access to robots.txt实施 MediaWiki 短网址 example.com/Main_Page,同时仍可访问 robots.txt
【发布时间】:2011-02-19 08:28:48
【问题描述】:

对于以下 .htaccess 我如何允许访问 robots.txt?

RewriteEngine On
RewriteCond %{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]

【问题讨论】:

    标签: .htaccess url rewrite mediawiki


    【解决方案1】:

    通常,使用 mod_rewrite,您将检查文件是否存在,如果存在,则不要去其他地方。

    在初始 RewriteCond 之后,添加

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    

    仅当请求的名称不存在文件或目录时,它才会继续使用 RewriteRule。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-15
      • 2014-01-29
      • 1970-01-01
      相关资源
      最近更新 更多