Before You Begin
Before we dive into the rewriting, we need to ensure your server is able to handle the rewrite module properly. By default, an Apache installation will come with the module included but not enabled. On shared hosting, it should have been enabled by your host and if not, contact them about it. If you use a VPS or dedicated, you may need to check for yourself and enable it if neccessary.
The easiest way to check if you have the module enabled is using phpinfo(). Assuming you have PHP installed, simply save <?php phpinfo(); ?> in a text file with .php extension and upload to your server. Run the script by pointing your browser to the address and search for "mod_rewrite". You should find it under "Loaded Modules". If it is there, you can skip onto mod_rewrite syntax. Otherwise, read on for how to enable it:
Enable the mod_rewrite Module
Apache is configured by an httpd.conf file - you will need to locate and open this file. In short all you need to know is that each command must be on a new line, and each line can be commented out using the \'#\' symbol.
Seach for the following line and ensure it is not commented out (i.e. there is not a # at the start of the line):
Save your changes and restart your server. See the previous section for how to check its enabled.