WordPress permalinks aren’t working, except for the default. How do I enable this rewriting? I’ve tried:
sudo a2enmod rewrite
sudo service apache2 restart
The permalinks are saving to the .htaccess in /localhost/wordpress:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
and I copy to root /var/www just to try, and it doesn’t make any difference.
I had also tried the AllowOverwride All, but it was in the wrong config file and it broke. (Correct file to add this to is /etc/apache2/sites-available/default) This had the solution for me.
Update for 13.10
On a new install, I got it working as described above, but with the following changes:
Instead of editing /etc/apache2/sites-available/default as they describe, you must use:
sudo gedit /etc/apache2/sites-available/000-default.conf
and add the following after the
DocumentRoot /var/www
line:As the tutorial describes, run
sudo a2enmod rewrite
Set up the /var/www/.htaccess file, and run:
And restart with
sudo service apache2 restart