500 Internal Server Error in codeigniter

17,451

Solution 1

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>

In config.php

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

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

Solution 2

In your database.php change your hostname to 'localhost'

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

In your .htaccess change the RewriteBase to

RewriteBase /

Try also to leave the config['base_url'] empty

$config['base_url'] = "";
Share:
17,451

Related videos on Youtube

Chaitanya K
Author by

Chaitanya K

Updated on June 04, 2022

Comments

  • Chaitanya K
    Chaitanya K almost 2 years

    I am using CodeIgniter 3.

    My .htaccess file contains the following.

    I am getting 500 Internal Server Error .

    I tried renaming the .htaccess file , i got 404 .

    I want to see the Apache error log. but i only have one folder in my root directory, which is public_html where my project files are based at.

    <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>
    

    in my config.php i have

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

    in database.php

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

    I cannot find /var/log/httpd/error_log how to get this , so that i can view the Apache error log ?