Skip to main content

Posts

Showing posts with the label url management

5 useful url rewriting examples using .htaccess

Now let’s look at the examples 1)Rewriting product.php?id=12 to product-12.html It is a simple redirection in which .php extension is hidden from the browser’s address bar and dynamic url (containing “?” character) is converted into a static URL. RewriteEngine on RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1 2) Rewriting product.php?id=12 to product/ipod-nano/12.html SEO expert always suggest to display the main keyword in the URL. In the following URL rewriting technique you can display the name of the product in URL. RewriteEngine on RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2 3) Redirecting non www URL to www URL If you type yahoo.com in browser it will be redirected to www.yahoo.com. If you want to do same with your website then put the following code to .htaccess file. What is benefit of this kind of redirection?? Please check the post about  SEO friendly redirect (301) redirect in php and .htaccess. RewriteEngine On Rewrit