Custom Worpress Permalinks and Ubuntu Apache2

Debian and hence Ubuntu has some security settings that prevent WordPress from allowing custom permalinks. In some installs Apache’s mod_rewrite will not play nicely with wordpress preventing it from changing links. This particular install was with WordPress 2.3 on an Ubuntu 7.10 system.  In order to get custom permalinks to work:

  1. Make sure mod_rewrite is enabled for Apache:
  2. sudo a2enmod rewrite

  3. Edit the config file in /etc/apache2/sites-enabled/
    In the default configuration, it is a called 000-default.
    Change both:
  4. AllowOverride None to AllowOverride All

  5. Restart Apache:
    sudo /etc/init.d/apache2 restart

Further configuration of .htaccess might be necessary.
If there is not a .htaccess file in the root wordpress directory (default server location is /var/www/ or /var/www/wordpress) you can make one by:
cd /var/www/
sudo touch .htaccess

Wordpress must be able to edit this file, so change the permissions:
sudo chmod 666 .htaccess
Go into the Worpress dashboard and make your custom permalinks. It should announce that .htaccess has been successfully modified. I recommend that the permissions be reset:
sudo chmod 644 .htaccess


One Response

  1. Just want to say thanks for posting this! I had to do this on a 10.04 install, I did everything everyone else suggested to do but then came across your page and it worked like a charm! Thanks :)



  • slide
  • slide
  • slide
  • slide
Casino Canada Online