How to enable mod_rewrite in Ubuntu 12.04 LTS
A little note first: This is the most seen way to enable mod_rewrite in tutorials. However, it’s not the best way. The correct way would be to setup a vhost and change its config, but unless you are a professional and know exactly what you do this thing will do the job perfectly.
Activate the mod_rewrite module with
sudo a2enmod rewrite
and restart the apache
sudo service apache2 restart
To use mod_rewrite from within .htaccess files, edit the default VirtualHost with
sudo nano /etc/apache2/sites-available/default
and change the first two occurrences of
AllowOverride None
to
AllowOverride All
Save and exit the nano editor via CTRL-X, “y” and ENTER.
Restart the server again:
sudo service apache2 restart
Voila! To check if everything is activated correctly, check your phpinfo() output. It should have this in it:
Thank you so much! This has solved a problem I’ve been having with WordPress permalinks.
You are a legend! I had read lots of tutorials on setting up mod_rewrite but none had added the changes to the default file which saved me no end of heartache. Thanks!!
Hi ,I’m following this tutorial ;but in the step of “sudo nano /etc/apache2/sites-available/default” I don’t have such “default” file on my system(Ubuntu 13.10) ;in that directory only have two files: “000-default.conf ” and ” default-ssl.conf” ;can someone give a help? about what’s going on.thanks