上传到一台主机后,500内部服务器错误一台主机、错误、服务器

2023-09-02 20:34:18 作者:枕江流

我已经找遍了所有当天在该论坛上,发现像我一样的问题,尝试了所有的答案,但只是不会工作。

在我locahost,全部的寄托是好的,但后来当我决定把它上传到网络服务器的现场,它开始呈现出

  

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

     

请与服务器管理员联系,   webmaster@reportingsystem.cnnpa.com并告知时他们   发生错误,以及任何你可能会做,可能有   造成错误。

     

这个错误的详细信息,可在服务器错误可用   登录。

     500 内部服务器错误 ,301后无法访问

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

在我的错误日志,我已经看到了这一点:

  [星期二1月29日22点零五分53秒2013] [错误] [客户112.198.77.50]文件不存在:/home/cnnpa/crs/404.shtml
[星期二1月29日22点05分53秒2013] [错误] [客户112.198.77.50]文件不存在:/家庭/ cnnpa / CRS / crimeindex
 

我觉得这有什么根据阅读类似的问题用的.htaccess和mod_rewrite的做。当我删除的.htaccess似乎工作,但我不希望这个解决方案,因为在第一个地方,我用的.htaccess对于具有清洁的URL(通过删除的index.php)的目的。

下面是我当前的.htaccess

 < IfModule mod_rewrite.c>
    RewriteEngine叙述上
    的RewriteBase / CRS /

    #Removes用户访问到系统文件夹。
    #Additionally这将允许您创建一个System.php控制器,
    #previously这将是不可能。
    #'系统'可以,如果你已重命名系统文件夹进行更换。
    的RewriteCond%{REQUEST_URI} ^系统。*
    重写规则^(。*)$ /index.php?/$1 [L]

    #当你的应用程序文件夹没有在系统文件夹
    #这个片断prevents用户到应用程序文件夹的访问
    Fabdrol:由#Submitted
    #Rename'应用'为您的应用程序文件夹名称。
    的RewriteCond%{REQUEST_URI} ^应用。*
    重写规则^(。*)$ /index.php?/$1 [L]

    #Checks,查看是否用户正在试图访问一个有效的文件,
    #such作为图像或CSS文档,如果这不是它发送的真实
    #request的index.php
    的RewriteCond%{} REQUEST_FILENAME!-f
    的RewriteCond%{} REQUEST_FILENAME!-d
    重写规则^(。*)$的index.php?/ $ 1 [L]
< / IfModule>

<!IfModule mod_rewrite.c>
    #如果我们没有mod_rewrite的安装,所有404的
    #可以被发送到index.php,一切工作正常。
    #提交者:ElliotHaughin

    的ErrorDocument 404的index.php
< / IfModule>
 

在我的config.php

  $配置['BASE_URL'] ='http://reportingsystem.cnnpa.com/';
$配置['index_page'] ='';
$配置['uri_protocol'] ='自动';
 

解决方案

 的RewriteBase / CRS /
 

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

看着你的config.php看来你是从DocumentRoot的服务于应用程序了。如果是这样的情况下,的RewriteBase应写为以下

 的RewriteBase /
 

I have searched all day in this forum and found same problems like mine,tried all the answers but just wont work.

In my locahost, everthing is fine, but later when I decided to upload it to a live webserver, it starts showing

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@reportingsystem.cnnpa.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

In my error log I've seen this:

[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

I think this has something to do with .htaccess and mod_rewrite based on reading similar questions. When I remove .htaccess it seems to work, but I dont want this solution because at the first place I used .htaccess for the purpose of having a cleaner URL's(by removing the index.php).

Here is my current .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>

in my config.php

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

解决方案

RewriteBase /crs/

My first suspect will be the RewriteBase value in your htaccess file.

Looking at your config.php it seems you are serving the application out from the DocumentRoot. if that is the case the RewriteBase should be written as below.

RewriteBase /