Enable-SEO-URLs-in-Apache

Enable SEO / Friendly URLs for Wordpress on Ubuntu

Working for an SEO UK Company I am often asked to configure Apache for Wordpress Permalinks AKA SEO / Friendly URL's. I have compiled the following tutorial to enable friendly URL's for Wordpress on Ubuntu, the following can be used as a guide for other web apps such as Drupal or Joomla however the .htaccess example below is specifically for Wordpress.

To start off with you need to update your .htaccess file manually, by adding the following code to it:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

You will probably notice that your Permalinks still 404 even after you have updated your .htaccess file, to fix this you need to enable Mod_Rewrite in Apache.

Enable Ubuntu mod rewrite

To enable mod_rewrite enter the following as root:

a2enmod rewrite
Restart Apache on Ubuntu

You will also need to restart Apache on Ubuntu:

/etc/init.d/apache2 restart

You will now be able to access your pages using the friendly human readable URL's, additional CMS configuration may be required for other we apps but that is beyond the scope of this document.


CategoryServerTeam

Enable-SEO-URLs-in-Apache (last edited 2012-03-16 18:28:27 by 109)