1

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
</Directory>

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 127.0.0.1] /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?

3
  • 2
    Check your error.log for what caused the 500 error.
    – Pekka
    Jun 25, 2010 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.” Jun 25, 2010 at 22:46
  • @Pekka I updated the question information.
    – Eugene
    Jun 26, 2010 at 7:05

2 Answers 2

2

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.

2
  • 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, 2010 at 8:10
  • @Eugene - Only if you're not root ;)
    – Kyle Smith
    Jun 26, 2010 at 21:32
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .