Hello friends welcome to findnerd. Today I am going to tell you how to enable mode_rewrite on Ubuntu 16.04. With activating mod_rewrite you will be able to manage URL rewrites. URL rewriting is done to make your website user friendly in terms of searching and SEO (Search Engine Optimization).
Before activating mod_rewrite, apache 2 must be installed on your server. If apache 2 is not installed on your server then you can install it by writing the following command:
Now you need to activate mod_rewrite, this can be done by writing the command:
$ sudo a2enmod rewrite
This command will enable the module. If module is activated already, then it will display message that it is already activated. Now after the command has been executed, in order to reflect it on the server we need to restart Apache server. Write the following command to restart the server:
$ sudo systemctl restart apache2
OR you can also use the following alternative command to restart server
$ sudo /etc/init.d/apache2 restart
Now mod_rewrite has been enabled completely on the server and you can rewrite url.