Reputation: 277
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
$config['base_url']='http://localhost/sc';
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
Upvotes: 3
Views: 40254
Reputation: 602
I had the same issue a year ago. 1. First and foremost, make sure that mod_rewrite module is enabled in your apache server ( Apache -> Apache Modules -> Rewrite_module [Just select] Or else See "Apache error log" under Apache Menu in wampserver to know more about the error). Don't waste time for other solution.
Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
Upvotes: 2
Reputation: 29
Activate Rewrite_module in wampserver Like Apache -> Apache Modules -> Rewrite_module [Just select] Or else See "Apache error log" under Apache Menu in wampserver to know more about the error
Upvotes: 0
Reputation: 5037
Activate a rewrite_module in your WAMP. It comes disabled by default
Upvotes: 3
Reputation: 483
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.
Upvotes: 8
Reputation: 1141
In CodeIgniter, If you are calling a model that tries to fetch values from a table that doesn't exist, you may face a 500 - internal server error.
Upvotes: 0
Reputation: 143856
See this question: .htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Essentially, you need to turn on mod_rewrite. That's why you're getting the " Invalid command 'RewriteEngine'
error message.
Additionally, since you're project path is in /sc/
you need to set you base to /sc/
:
RewriteEngine On
RewriteBase /sc/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1
And place the htaccess file in the /sc/
folder.
Upvotes: 5