Enable URL Rewriting on Apache

After installing apache, you can enable mod_rewrite by running the following commands.

sudo a2enmod rewrite
sudo service apache2 restart

You will probably want to use the .htaccess file to configure your mod_rewrite. In this case, you should make sure to allow overrides by modifying your site’s configuration file. If you haven’t already, I suggest creating/copying the default config in /etc/apache2/sites-enabled. To enable the .htaccess file, add the following.


    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all

Pay attention to the Directory element and the path that follows. For me, this path is different and for you it may be different as well. And as usual, restart the apache service.

sudo service apache2 restart

There are no comments.

Leave a Reply

Navigation