Examples of url rewriting for seo friendly URL
For rewriting the URL, you should create a .htaccess file in the root folder of your web directory. And have to put the following codes as your requirement.
RewriteRule ^(.*)\.htm$ $1.php [nc]
following example will rewrite the test.php to test.html i.e when a
URL like http://localhost/test.htm is called in address bar it calls the
file test.php. As you can see the regular expression in first part of
the RewriteRule command and $1 represents the first regular expression of the part of the RewriteRule and [nc] means not case sensitive.
RewriteRule ^product-([0-9]+)\.html$ products.php?id=$1
following example will rewrite the product.php?id=5 to porduct-5.html
i.e when a URL like http://localhost/product-5.html calls product.php?id=5 automatically.