How-To: Permalink with Ubuntu LAMP
WordPress Permalinks with Ubuntu LAMP
Enabling permalinks in Wordpress is not to difficult, if your server configuration is precisely correct. If it was like mine, however, you may be in for a frustrating few hours. There are permissions to be hacked on, conf files to change, and apache mods to be enabled. This is a quick and dirty guide to enabling those search engine friendly permalinks on a typical Ubuntu LAMP installation.
What You Need
- Sudo access to server
- Minimal terminal expertise
- Internet connection
- This guide
What You Do
Run the following commands
First, to enable the rewrite module in Apache2
sudo a2enmod rewrite
Then to get the .htaccess file to work, open the defaults config file
sudo nano /etc/apache2/site-available/defaults
Find the line that says:
AllowOverride None
and edit it so that it reads:
AllowOverride All
Tip: ctl+x to exit, hit ‘y’ to save your changes!
Next we need to create an .htaccess file
sudo nano /var/www/.htaccess
This assumes that your wordpress blog is in your root www folder. If not change the file path to your root
That’s all, we just needed to create it, wordpress can do the hard work of putting something in there. To allow Wordpress to make changes, however we need to (briefly) change the permissions on the file. Do this with this command
sudo chmod 777 /var/www/.htaccess
Perfect. Now to restart Apache to get all those changes worked in,
sudo /etc/init.ed/apache2 restart
This should restart without Apache without any errors. Now navigate to your blogs admin page, go to ‘permalinks’ under ’settings’ and select how you want your permalinks to look. Do not forget to hit ‘Save’ down at the bottom! There should be no errors when you hit save.
Now, you need to change those permissions back, we certainly don’t want anyone to be able to change and execute our .htaccess!
sudo chmod 644 /var/www/.htaccess
Should just about fix you up. Hopefully this is helpful.
No comments yet.