mod_rewrite is enabled, but not working

Solution 1:

You need to allow the overwrite.

<Directory "/path/to/document/root/">
  AllowOverride All

</Directory>

Solution 2:

First of all, set your httpd configuration to this (the path may differ with one another. In my ubuntu it's placed at /etc/apache2/sites-available/default):

DocumentRoot /var/www

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    allow from all
</Directory>

After that, you should enable mod_rewrite with this command:

sudo a2enmod rewrite

The last one, restart your apache service:

sudo service apache2 restart

To ensure that, you can check it again from phpinfo in Configuration > apache2handler > Loaded Modules there must be written mod_rewrite and it means mod_rewrite is enabled.

Solution 3:

I had the similar problem, but the other answers did not helped me. This line at the begining of .htaccess solved my problem:

Options +FollowSymLinks -MultiViews