Enable Apache mod_rewrite Module in Ubuntu & LinuxMint

Some times you faced issues that Apache server is not reading your .htaccess or Apache is not rewriting urls while we are using correct rewrite rules in configuration files. This happens due to Apache rewrite module is not enabled. When we installed a fresh Apache server mod_rewrite is not enabled by default on your server, So to use rewrite configurations you need to manually enable mode_rewrite module on your system.
1. Enable mod_rewrite Module in Apache2
We use a2enmod command to enable any modules in Apache2 web server. So use following command to enable mod_rewrite module in your Apache setup.
$ sudo a2enmod rewrite

2. Activate ReWrite in VirtualHost

After enabling Apache rewrite module, now you need to add “AllowOverride All” in your VirtualHost configuration file. This setting can also be enabled globally by editing Apache main configuration file.
<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
</Directory>

3. Restart Apache2 Configuration

After enabling mod_rewrite module in Apache you also need to reload Apache2 server to reload all configuration to running environment.
$ sudo service apache2 restart
08 Feb 2016

About Author:


I am a Linux Administrator and Security Expert with this site i can help lot's of people about linux knowladge and as per security expert i also intersted about hacking related news.TwitterFacebook

Next
How to Install Ionic Framework on Ubuntu, Debian and LinuxMint
Previous
How to Deny/Allow Access for Users & Groups in OpenSSH
 
Top