Chinthu Chinthu - 1 year ago 121
PHP Question

codeigniter localhost internal server error 500

I am starting a new project in codeigniter. While setting up work folder in localhost i put the following htaccess file in my project root folder for remove index.php from the url

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1

now i am getting the error message as follows

"Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request."

my project path is localhost/sc

in the config.php file
i put the following line


server error message is " Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration"

I am using wamp server in windows platform
please help me to solve this problem

Thank you

Answer Source

This .htaccess script works perfectly for me. Place it within the first set of folders inside your project directory. Same level as the index.php file

RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

The error 500 can be checked on the apache error.log file using the following path /var/log/apache2/error.log

Check the last error listed and fix it.