How to enable mod_rewrite in Ubuntu

To enable Rewrite module in Ubuntu run the following command within your terminal.

sudo a2enmod rewrite

In order to apply the changes you need to restart your Apache.

sudo service apache2 restart

If you are planning to use rewrite via htaccess file, open the apache configuration file.

sudo nano /etc/apache2/sites-available/000-default.conf

In this file look for,

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

Replace AllowOverride None with AllowOverride All. 

To apply changes, restart your server again.

sudo service apache2 restart

Useful Read : Change Default Namespace For a Laravel Application


Leave a Comment.