使用PHP CGI在根域上的CodeIgniter错误404

时间:2013-11-12 10:34:17

标签: php apache .htaccess codeigniter

所以,今天我将服务器上的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.php

$config['base_url'] = "http://".$_SERVER['HTTP_HOST'];
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";

routes.php文件

$route["default_controller"]    = "home";
$route["error_controller"]      = "error";
$route['scaffolding_trigger'] = "";

我正在尝试将uri_protocol更改为QUERY_STRING&amp; REQUEST_URI但仍无效。

1 个答案:

答案 0 :(得分:2)

我设法通过在我的.htaccess上添加DirectoryIndex home来解决这个问题。