Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Yesterday I installed LAMP on my Ubuntu 10.04. At first everything seemed fine, but, when I launched my PHP app (I copied it from Windows 7, where I use XAMPP) it didn't accept my .htaccess file. So all of my URLs are broken at the moment.

What I did for .htaccess to work.

1.When I created separate config file in ./sites-available/ I changed Directory section AllowOverride from None to All

<Directory /some_path/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all

2.Also the first line in my .htaccess file is RewriteEngine On.

Everything worked fine on Windows in XAMPP. When I launched http://localhost it gave me 500 Internal Server Error. When I change AllowOverride back to None, it opens index.html in my root folder and not index.php.

UPD: error.log says about error 500:

[Sat Jun 26 09:40:53 2010] [alert] [client] /some_path/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

Could anyone suggest any solution on how to fix it?

share|improve this question

migrated from Jun 26 '10 at 8:03

This question came from our site for professional and enthusiast programmers.

Check your error.log for what caused the 500 error. – Pekka 웃 Jun 25 '10 at 22:28
Apparently, setting the AllowOverride directive to None only prevents the symptom of your issue popping up: “When this directive is set to None, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.” – Marcel Korpel Jun 25 '10 at 22:46
@Pekka I updated the question information. – Eugene Jun 26 '10 at 7:05
up vote 2 down vote accepted

According to the error message mod_rewrite hasn't been loaded. Activate it with a2enmod rewrite and restart your Apache httpd with service apache2 restart.

share|improve this answer
Great. Worked as a charm. But for those who will read this question and who are new to all of that it is better to add sudo before every command in this answer. – Eugene Jun 26 '10 at 8:10
@Eugene - Only if you're not root ;) – Kyle Smith Jun 26 '10 at 21:32

You seem not to have installed or activated mod_rewrite in your Apache installation. The line

Invalid command 'RewriteEngine'

is pretty clear. When you set AllowOverride to none, the .htaccess file will not be parsed at all, thus, no error message appears.

You would have to activate or install the mod_rewrite module.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.