2
votes

First off, before somebody posts this link, I will tell you I have looked through it and tried what it said to no avail. .htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

I am using Codeigniter on a website and am attempting to get rid of the index.php in the URL. This code has been added to the .htaccess file in the root of my website.

 RewriteEngine on
 RewriteCond $1 !^(index\.php|images|robots\.txt)
 RewriteRule ^(.*)$ /index.php/$1 [L]

When I test it I get a 500 internal server error. Checking the error logs is says "Invalid Command 'RewriteEngine'". In the mods-enabled folder rewrite.load is listed. Also, I have restarted Apache after enabling rewrite.

Spent a few hours messing around with this and still have the same problem. Thanks in advance.

Source for .htaccess code: http://ellislab.com/codeigniter/user-guide/general/urls.html

2
Did you remember to restart Apache after enabling mod_rewrite? - jprofitt

2 Answers

1
votes

"Invalid Command 'Rewrite Engine'"

Are you sure you don't have a space between "Rewrite" and "Engine" here? The htaccess syntax is not very forgiving when it comes to whitespace and having "Rewrite Engine" will definitely make it break.

0
votes

There was an error starting Apache and when it was fixed everything worked. Thanks for the help anyway.