Codeiniter错误:服务器错误500

时间:2015-11-30 13:44:13

标签: php .htaccess codeigniter

我有一个使用Codeigniter设计的应用程序,一切都在我的localhost上工作正常,但在实时部署之后。当我尝试打开http://www.wesecure.com.ng/posts/view_posts/3时,我收到响应服务器错误500。

我已经通过网络进行了搜索,但似乎没有任何解决方案因某些技术原因而无法解决。非常感谢您的支持

.htaccess.php

<IfModule mod_rewrite.c>

 # allow_override On
 # mod_rewrite is installed

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

 <IfModule mod_php5.c>
     RewriteRule ^(.*)$ index.php/$1 [L]
 </IfModule>

 <IfModule !mod_php5.c>
     RewriteRule ^(.*)$ index.php?/$1 [L]
 </IfModule>

</IfModule>

$ config [&#39; index_page&#39;] =&#39; http://www.wesecure.com.ng/&#39 ;; $ config [&#39; uri_protocol&#39;] =&#39;自动&#39;;

2 个答案:

答案 0 :(得分:0)

首先.htaccess不是.php文件。

这是一个名为.htaccess dot的文件。 将其设置为:

 RewriteEngine on

 # enable the directives - assuming they're not enabled globally
 ExpiresActive on

 # send an Expires: header for each of these mimetypes (as defined by server)
 ExpiresByType image/png "access plus 1 month"
 ExpiresByType image/gif "access plus 1 month"
 ExpiresByType image/jpeg "access plus 1 month"

 # css may change a bit sometimes, so define shorter expiration
 ExpiresByType text/css "access plus 1 days"

RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

在配置中:

$config['base_url'] = false;
$config['uri_protocol'] = "REQUEST_URI";

答案 1 :(得分:0)

您的文件应该以.htaccess扩展名保存,而不是.php,只需将代码行放在.htaccess文件中:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]