May 09

mod_rewrite problems in Apache2 + Ubuntu ?

How to check whether mod_rewrite is installed?

Create a text file named check.php in the www folder and insert the following code to it.

<?php phpinfo(); ?>

Then go to the web page in your browser using the url “localhost/check.php”. Then you’ll see information about the php version of the system. Under the “Configuration” title there’s another title called “apache2handler”. In that table there’ll be a entry named “Loaded Modules”. Check to see if it contains the name “mod_rewrite “.If you can see that name then mod_rewrite is installed to apache.

If mod_rewrite is not installed?

mod_rewrite can be installed using the “sudo a2enmod rewrite” command in the terminal.

How to check whether mod_rewrite is working properly?

A good tutorial on this can be found in

mod_rewrite is not working even though it is installed?

Navigate to /etc/apache2/sites-enabled as root and open the text file “000-default”. Then replace all the “AllowOverride None” with “AllowOverride All”( There’ll be 3 entries ). Then restart apache using sudo /etc/init.d/apache2 restart .

This should solve the problems.

Share Button