1

即使没有对任何文件进行任何更改,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> 
4

1 回答 1

1

在这种情况下,我 100% 确定您的 mod_rewrite 无法正常工作。还要确保您的 .htacess 文件位于您的根目录中。让这个在我的服务器上正常工作可能会对您有所帮助:-

# rewrite rules
RewriteEngine On

# ditch index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L] 
于 2012-10-15T20:34:35.023 回答