Making the links pretty using Apache Rewrite


Use Apache Rewrite and htaccess to get Apache rewrite to work and make your urls pretty on Ubuntu. Lets assume that your website root directory is located in /var/www/headstation. Say you want to make this url:

wiki.php?tag=home

look like:

/wiki/home

In the website root doc directory, add a .htaccess file with following content:

RewriteEngine On  
RewriteBase /headstation/website/
RewriteRule ^wiki/(.*)/?$ wiki.php?tag=$1 [NC,L]

Check the /etc/apache2/sites-available/ and ensure that the following lines are in the site-available conf file for the site:


  Options FollowSymLinks
  AllowOverride None

Make sure that Multiviews is not in the lines above. Thats it!