【问题标题】:500 Internal Server Error after uploading to a host上传到主机后出现 500 内部服务器错误
【发布时间】:2013-01-13 03:59:36
【问题描述】:

我在这个论坛上搜索了一整天,发现了和我一样的问题,尝试了所有的答案,但就是不行。

在我的本地主机中,一切都很好,但后来当我决定将其上传到实时网络服务器时,它开始显示

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

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

有关此错误的更多信息可能在服务器错误中可用 记录。

此外,在执行过程中遇到了 500 Internal Server Error 错误 尝试使用 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';

【问题讨论】:

  • 我认为你的文件和目录权限有问题
  • 服务器上是否存在404.shtml 文件?
  • 您要上传的文件有多大?
  • @KalpeshMehta,我所有的文件夹权限都设置为 755,所有文件都设置为 644
  • @YogeshSuthar,我不知道为什么它给我关于丢失文件的错误。我很确定我没有这样的文件。这些文件甚至不在 codeigniter 默认包中。

标签: php .htaccess codeigniter url mod-rewrite


【解决方案1】:
RewriteBase /crs/

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

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

RewriteBase /    

【讨论】:

  • 这行得通!我对重写库的了解是包含我的网站文件的文件夹的名称
猜你喜欢
  • 1970-01-01
  • 2015-04-29
  • 2013-02-10
  • 1970-01-01
  • 1970-01-01
  • 2013-07-06
  • 1970-01-01
  • 1970-01-01
  • 2022-01-10
相关资源
最近更新 更多