a digital blog

HTACCESS, PHP, Tutorial

SEO Friendly URL using HTACCESS

SEO-Friendly-URL

This post explains how to create SEO friendly URL using .htaccess mod redirection. Before trying this you have to enable mod_rewrite.so module at httpd.conf.

For more information about htaccess and mod_rewrite go to my previous tutorial http://www.91weblessons.com/what-is-htaccess

SEO friendly are known to be better than Dynamic URLs because of a number of reasons

1. SEO friendly typically Rank better in Search Engines.
2. SEO friendly are known to index the content of dynamic pages a lot slower compared to static pages.
3. SEO friendly are always more friendlier looking to the End Users.
Example of a dynamic URL

http://www.91weblessons.com/product.php?catName=books

And Re-written seo friendly url using htaccess like this:-

http://www.91weblessons.com/books

So you can achive this seo friendly using below mention code in htaccess file:-

RewriteEngine On
  RewriteRule ^([^/\.]+)/?$ product.php?catName=$1

In this htaccess rule anything after your domain name can be use as a query string with variable reference catName.

 

What happen if two variable in query string like:-

http://www.91weblessons.com/product.php?catName=books&bookName=javascript

And Re-written seo friendly url using htaccess like this:-

http://www.91weblessons.com/books/javascript

So you can achive this seo friendly using below mention code in htaccess file:-

RewriteEngine On
RewriteRule ^([^/\.]+)/([^/\.]+)?$ product.php?catName=$1&bookName=$2

 

What happen if two id in query string like:-

http://www.91weblessons.com/product.php?catName=1&bookName=3

And Re-written seo friendly url using htaccess like this:-

http://www.91weblessons.com/ catName /1/ bookName/3

So you can achive this seo friendly using below mention code in htaccess file:-

RewriteEngine on
RewriteRule product/catName/(.*)/bookName/(.*)/product.php?catName=$1&bookName=$2

 

And also we can handle this url into other ways like this:-

http:// www. 91weblessons.com/product-catName -1-bookName-3.htm

So you can achive this seo friendly using below mention code in htaccess file:-

RewriteEngine on
RewriteRule product-catName-(.*)-bookName-(.*)\.html$ product.php?catName=$1&bookName=$2

9 Comments

  1. very Informative Blog !!

    Thanks for Sharing

  2. Hi there to every one, the contents present at this web page are genuinely awesome for people experience, well, keep up the nice work fellows.

  3. Very nice style and fantastic subject material, nothing at all else we want :D .

  4. Hello! I simply would like to give an enormous thumbs up for the great info you might have here on this post. I will be coming back to your weblog for more soon.

  5. You actually make it seem so easy with your presentation but I find this matter to be really something that I think I would never understand. It seems too complicated and very broad for me. I’m looking forward for your next post, I’ll try to get the hang of it!

  6. admin

    Thank you seo tutorial :)
    I am glad, that you like this blog…

  7. seo tutorial

    wonderful put up, very informative.

  8. phpusa

    I am looking for the same from last 2 days.
    And finally come to your blog, You just make my day…..:)


*

Copyright © 91 Web Lessons - a digital blog