【发布时间】:2023-03-06 06:45:02
【问题描述】:
即使没有对任何文件进行任何更改,Codeigniter htaccess 也会突然启动问题。我可以访问
- www.mysite.com/index.php/controller/method
但是当我访问时
- www.mysite.com/controller/method
它给出了一般的 404,而不是 codeigniter 404。任何帮助表示赞赏。该网站已关闭。
这是我现在的 htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css folders, and the robots.txt file
#Submitted by Michael Radlmaier (mradlmaier)
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
【问题讨论】:
-
真的没有任何改变吗?这不太可能,请检查(如果您没有更改任何内容)您的托管公司并询问是否发生了任何更新。
-
我已经问过他们他们否认改变任何东西。我昨天做了一些更改,但该网站在 12-14 小时后正常工作,没有任何问题。我已经恢复了昨天的旧版本,但我仍然遇到这个问题。
-
您是否对网站的相关部分进行了更改?你有 Apache 的日志并看到任何错误吗?
-
您是否尝试对文件进行任何编辑?一些编辑器会弄乱行尾 - 我曾经在一行上得到一个“压缩”的 javascript 文件,在我的原始文件中,第一行是
//注释......另外,尝试注释掉 @ 987654323@线。并检查 Apache 日志 -
你确定 mod_rewrite 仍然安装并且你的 htaccess 规则实际上在做任何事情吗?
标签: .htaccess codeigniter mod-rewrite web