【问题标题】:CodeIgniter : Failed to load resource: the server responded with a status of 500 (Internal Server Error)CodeIgniter:加载资源失败:服务器响应状态为 500(内部服务器错误)
【发布时间】:2015-07-09 13:27:26
【问题描述】:

在本地服务器我的Codeigniter项目在这里没有问题,但是当它连接到网络服务器时发生内部服务器错误

我的 .htaccess

# index file can be index.php, home.php, default.php etc.
DirectoryIndex index.php

# Rewrite engine
RewriteEngine On

# condition with escaping special chars
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

并且所有目录权限都设置为755

并且所有目录权限都设置为644

我的网站在控制台日志中给出以下消息

加载资源失败:服务器响应状态为 500(内部服务器错误)

我该如何解决这个问题? 请有人帮助我。

【问题讨论】:

  • 你使用 .htaccess 吗?您在 localhost 中使用什么 URL,从服务器请求时使用什么 URL?
  • 您使用的是什么版本的 Codeigniter?
  • 在您的 index.php 中,您是否将环境设置为“生产”、“开发”、“测试”?
  • 如果您编辑您的原始帖子并包含您的文件结构也会很有帮助。您可以通过访问此站点创建一个:filestructuregenerator.com
  • 我正在使用 codeigniter 2.2

标签: php codeigniter


【解决方案1】:

请尝试将 htaccess 内容替换为:

重写引擎开启 RewriteCond $1 !^(index.php|application/path_to_your_theme|images|assets|robots.txt) RewriteRule ^(.*)$ index.php/$1 [L]

别忘了替换 application/path_to_your_theme

【讨论】:

    猜你喜欢
    • 2018-01-22
    • 2013-04-16
    • 1970-01-01
    • 1970-01-01
    • 2014-11-24
    • 2021-07-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多