2
我一直在爬遍整個互聯網,並沒有其他人使用的解決方案正在爲我工作。問題是默認的控制器是唯一可以加載的控制器。這裏有很多關於這個主題的文章。但我已經嘗試了所有這些,包括主要建議嘗試$config['uri_protocol']
的所有五個設置。我嘗試了所有五種設置,但都沒有工作。CodeIgniter只加載默認控制器
我也嘗試了幾種不同的.htaccess設置,這些都沒有幫助。這是我嘗試過的一對夫婦。首先是來自他們網站的官方CI .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]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
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
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>
和
#Standard CodeIgniter Rewrite
#-------------------------------------
RewriteCond $1 !^(index\.php|resources|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] AddHandler cgi-script .pl
不過,沒有運氣。有人可以將我引入正確的.htaccess和$ config ['uri_protocol']設置組合。所有的答案都有所不同。這是因爲不同的服務器配置?