Enable any Apache module using the a2enmod command.
Command below on your Ubuntu server:
$ sudo a2enmod rewrite
In case the module is already enabled on your server, you will get an alert message.
Restart Apache once you make any change to its configuration.
Type the command below on a terminal window:
$ sudo systemctl restart apache2
Server is now ready to accept rewrite rules.