http://code.tutsplus.com/tutorials/an-in-depth-guide-to-mod_rewrite-for-apache--net-6708 - This is a good tutorial.
httpd.conf file for your server and uncomment the following line by removing the
# LoadModule rewrite_module modules/mod\_rewrite.so
Create a file called
.htaccess (no name, extension .htaccess) and open it in your code editor of choice and enter the following:
Which enables the rewrite engine obviously. From there you can make rewrite declarations by writing
RewriteRule followed by a regular expression that matches the URL you are trying to catch, followed by the URL you want to be "redirected" to, using
$1, $2, ... , $n etc to match the bracketed parts of the regex respective of the order they appear in it.
RewriteEngine on RewriteRule ^/view/([0-9]+)/?$ /view.php?cat=$1
Save that file in the root of your website. Would take
http://adityasastry.in/view/666 and "redirect" to
http://adityasastry.in/view.php?cat=666. I would suggest reading the article I mentioned above as it covers this practice in far greater detail.