Search code examples
apache.htaccesscodeigniterinternal-server-error

500 Internal Server Error in codeigniter


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 ?


Solution

  • 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