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 a2enmodcommand to enable any modules in Apache2 web server. So use following command to enable mod_rewrite module in your Apache setup.
$ sudo a2enmodrewrite
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.
Options Indexes FollowSymLinks
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.