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?
-
You seem not to have installed or activated
mod_rewritein your Apache installation. The lineInvalid command 'RewriteEngine'is pretty clear. When you set
AllowOverridetonone, the.htaccessfile will not be parsed at all, thus, no error message appears.You would have to activate or install the
mod_rewritemodule.From Pekka -
According to the error message mod_rewrite hasn't been loaded. Activate it with
a2enmod rewriteand restart your Apache httpd withservice apache2 restart.Eugene : 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.Kyle Smith : @Eugene - Only if you're not root ;)From joschi
0 comments:
Post a Comment