所以,今天我将服务器上的 PHP 和 apache 升级到 PHP 5.4 和 Apache 2.4 版本。然后我注意到在一个使用旧版本 codeigniter 的域上(我尝试回显 CI_VERSION 但它什么也没显示)在根域上显示错误 404。但是输入 domain.com/home 可以正常工作。(家是我的默认控制器)。键入任何其他控制器也可以正常工作。但是 domain.com 显示错误 404。
.htaccess
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
#'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
RewriteRule ^(.*)$ index.php/$1 [L]
#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|apc\.php|assets|nivo-slider|hr|stm|elearning|docs|adminer|favicon\.ico|file|flash|tinymce|robots\.txt)
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.
ErrorDocument 404 /application/errors/404.php
</IfModule>
配置文件
$config['base_url'] = "http://".$_SERVER['HTTP_HOST'];
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
路由.php
$route["default_controller"] = "home";
$route["error_controller"] = "error";
$route['scaffolding_trigger'] = "";
我尝试将 uri_protocol 更改为 QUERY_STRING 和 REQUEST_URI 但仍然无法正常工作。