How to Enabling mod_rewrite in Apache on Ubuntu 18.04

How to Enabling mod_rewrite in Apache on Ubuntu 18.04

Introduction

Apache’s mod_rewrite module lets you rewrite URLs in a cleaner fashion, translating human-readable paths into code-friendly query strings. It also lets you rewrite URLs based on conditions.

An .htaccess file lets you create and apply rewrite rules without accessing server configuration files. By placing the .htaccess file in the root of your web site, you can manage rewrites on a per-site or per-directory basis.

In this tutorial, you’ll enable mod_rewrite for Apache in Ubuntu 18.04

Enabling mod_rewrite

In order for Apache to understand rewrite rules, we first need to activate mod_rewrite. It’s already installed, but it’s disabled on a default Apache installation. Use the a2enmod command to enable the module:

sudo a2enmod rewrite

This will activate the module or alert you that the module is already enabled. To put these changes into effect, restart Apache.

sudo systemctl restart apache2

mod_rewrite is now fully enabled.


Posted by aeterno

The author and creator Mimata from Indonesia who founded Mimata Back in 2018. He is passionate about all things tech and knows the Machine Learning, IoT, Micro Controller, and many others

Leave a Reply