上传到主机后出现500内部服务器错误

时间:2013-01-29 14:33:39

标签: php .htaccess codeigniter url mod-rewrite

我在这个论坛上搜索了一整天,发现了像我一样的问题,尝试了所有的答案,但却无法工作。

在我的locahost,everthing很好,但后来当我决定将它上传到实时网络服务器时,它开始显示

  

服务器遇到内部错误或配置错误   无法完成您的请求。

     

请联系服务器管理员,   webmaster@reportingsystem.cnnpa.com并告知他们时间   发生了错误,以及您可能做过的任何事情   导致错误。

     

有关此错误的详细信息可能在服务器错误中可用   日志中。

     

此外,遇到500内部服务器错误错误   尝试使用ErrorDocument来处理请求。

在我的错误日志中,我见过这个:

[Tue Jan 29 22:05:53 2013] [error] [client 112.198.77.50] File does not exist: /home/cnnpa/crs/404.shtml
[Tue Jan 29 22:05:53 2013] [error] [client 112.198.77.50] File does not exist: /home/cnnpa/crs/crimeindex

我认为这与基于阅读类似问题的.htaccess和mod_rewrite有关。当我删除.htaccess它似乎工作,但我不想要这个解决方案,因为在第一个地方我使用.htaccess目的是有一个更清晰的URL(通过删除index.php)。

这是我目前的.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /crs/

    #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>

在我的config.php中

$config['base_url'] = 'http://reportingsystem.cnnpa.com/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

1 个答案:

答案 0 :(得分:3)

RewriteBase /crs/

我的第一个嫌疑人将是你的htaccess文件中的RewriteBase值。

查看你的config.php,似乎你正在从DocumentRoot中提供应用程序。如果是这种情况,RewriteBase应该写成如下。

RewriteBase /