There are two possible problems you might have:
1) Is mod_rewrite enabled? Check with this command: apache2ctl -M | grep rewrite
– you should see a line similar to rewrite_module (shared)
if it's enabled. If not – enable it.
2) Do you have permissions to use .htaccess files? Check the configuration for your virtualhost – this should contain the line AllowOverride, similar to this:
<Directory "/var/www/your/site/">
Options FollowSymLinks
AllowOverride None
Order allow,deny
allow from all
</Directory>
Now in my example mod_rewrite wouldn't work, because AllowOverride is set to None. Check what you need here: http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride but you basically need to set it to any other valid option, that is not None
, otherwise Apache will completely ignore .htaccess
files.