【问题标题】:codeigniter 3 showing not found page[.htaccess and robot.txt]codeigniter 3 显示未找到页面 [.htaccess 和 robots.txt]
【发布时间】:2018-06-29 10:58:30
【问题描述】:

我正在尝试将robot.txt 放在我的godaddy 网站上。 我把它放在根目录上。 但我得到error404 not found 我认为这是由于我的 .htaccess

Htaccess 文件

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>

我也尝试在 htaccess 中添加条件,但没有帮助

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|assets)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>

有什么解决方法吗?

【问题讨论】:

    标签: php apache .htaccess codeigniter mod-rewrite


    【解决方案1】:

    试试这个htaccess:

    DirectoryIndex index.php
    RewriteEngine on                       
    RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|js|robots\.txt|favicon\.ico)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ ./index.php?$1 [L,QSA] 

    【讨论】:

      猜你喜欢
      • 2018-05-13
      • 2012-08-27
      • 1970-01-01
      • 2021-01-24
      • 1970-01-01
      • 2015-08-14
      • 1970-01-01
      • 2015-07-28
      • 1970-01-01
      相关资源
      最近更新 更多