How To Enable mod_rewrite In Ubuntu Linux
mod_rewrite is an Apache web server module which is used to rewrite a URL at the server level. This module has a variety of uses. But it is most frequently used to provide clean, search engine friendly URLs.
This article explains how to enable Apache
mod_rewrite in Ubuntu Linux.
Step 1 : Install Apache web server in Ubuntu Linux
I had already explained this step in a previous post. If you don’t know, then read how to install LAMP server in Ubuntu.
Step 2 : Enable mod_rewrite module in Apache web server
mod_rewrite module is disabled by default in Apache web server. So you will have to enable it prior to using it.
Open a terminal and enter the following command to enable mod_rewrite module in Ubuntu Linux.
$ sudo a2enmod rewrite
a2enmod is a command line tool which is used to enable modules in Apache web server.
Step 3 : Edit the site specific file in the
By default Apache will have a file named
000-default in the
sites-enabled/ directory. The full path being
Open the file in a text editor of choice and change all the lines containing
AllowOverride None to
AllowOverride All. Save the file and exit.
If you are running a website on a separate domain and on a remote server, your file will be different. Choose the file accordingly.
Step 4 : Restart the Apache web server
The final step is to restart the apache web server to make the changes take effect. This is done as follows –
$ sudo /etc/init.d/apache2 restart
Also check out how you can enable mod_rewrite in XAMP server in Windows.
[Reference : Ubuntu Forums]