codeigniter中的500内部服务器错误

时间:2015-03-26 07:32:26

标签: apache .htaccess codeigniter internal-server-error

我正在使用CodeIgniter 3.

我的.htaccess文件包含以下内容。

我收到500内部服务器错误。

我尝试重命名.htaccess文件,我得到了404。

我想看看Apache错误日志。但我的根目录中只有一个文件夹,public_html我的项目文件所在的文件夹。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase http://www.xyzsolutions.com/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>

config.php我有

$config['base_url'] = 'http://www.xyzsolutions.com/'; 

$config['index_page'] = ' ';

在database.php中

'hostname' => 'http://www.xyzsolutions.com/',

我找不到/var/log/httpd/error_log 如何获得这个,以便我可以查看Apache错误日志?

2 个答案:

答案 0 :(得分:2)

在您的database.php中,将您的主机名更改为&#39; localhost&#39;

$config['hostname'] => 'localhost';

在.htaccess中将RewriteBase更改为

RewriteBase /

还要尝试将配置[&#39; base_url&#39;]留空

$config['base_url'] = "";

答案 1 :(得分:2)

I solved the issue , changed my .htaccess to

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>

在config.php中

$ config [&#39; base_url&#39;] =&#39; http://www.xyzsolutions.com/&#39;;

And As i am using Codeigniter version 3

The Controllers and model files names should start with an upper case,

Eg:

models/User_model.php
controllers/Welcome.php 

I named my files with lower case( starting letter )so i was getting 404.

Lower case thing worked in localhost , but in server it will not work