Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Enabling Mod Rewrite On Apache2

Let's look to enable mod_rewrite so our WordPress permalinks work as we would like them too.

Jun 08, 2023 • 0 Minute Read

A user recently requested information on enabling mod_rewrite for Apache. They were trying to configure WordPress to use permalinks. Fortunately for us, there are two ways to enabled mod_rewrite and they are really simple. First, we will assume that you have Apache2 installed as your web server. Before we get started, if you are looking for a how-to setup Apache/WordPress then you can follow this screencast for a walk through of the process.Here is the first method to enable mod_rewrite so our WordPress permalinks work as we would like them too; this is for Debian/Ubuntu servers.Ssh into your instance and type at the console :~$ sudo a2enmod rewriteOnce this is completed we must restart Apache to apply the changes.Type :~$ sudo /etc/init.d/apache2 restartIf you look at the a2enmod command it's rather simple. a2enmod = Apache2 Enabled ModThe a2enmod command actually moves the Apache module files from /etc/apache2/mods-available to /etc/apache2/mods-enabled.The second method is to manually move the module files ourselves. Here's how we accomplish this task::~$ sudo mv /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/:~$ sudo /etc/init.d/apache2 restartThe first method is the preferred and right method to do this. So if at all possible stick with that method.