【问题标题】:Redirect all to index and unable to get robots.txt全部重定向到索引,无法获取 robots.txt
【发布时间】:2019-05-05 00:37:30
【问题描述】:

这是我的 .htacces

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [NC,L]

所有请求都发送到索引并路由到正确的 PHP 控制器。如何向 robots.txt 添加例外。此时google找不到文件,因为Router无法匹配路由并返回404错误

【问题讨论】:

    标签: .htaccess robots.txt


    【解决方案1】:

    试试这个重写:

    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^\/robots\.txt$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [NC,L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-09
      • 1970-01-01
      • 2015-08-07
      • 1970-01-01
      • 1970-01-01
      • 2019-04-03
      • 2015-12-06
      • 1970-01-01
      相关资源
      最近更新 更多