Click to find out more about our Work

Posts Tagged ‘mod_rewrite’

August 7th, 2008

Tutorial : Creating “Pretty SEO URLS” using Apache’s mod_rewrite

Imagine this, You have a dynamic site powered by PHP/MySQL, its doing ok, you have submitted your website URL to all the known search engines, but still your site doesn’t seem to get much traffic from the search engines…ever wondered why ?

Well firstly, search engines have billions of pages to search. Imagine your link to be something like www.yourdomain.com/index.php?page=aboutme, its tough for any search engine to comprehend any keywords from the link.
But how about www.yourdomain.com/page/about-me.html ? These links are static Links, SEO Friendly Links, “Pretty Links”.

So today we are going to learn how to convert your ugly links into pretty links.

Index

  1. Step 1 : Enable mod_rewrite in httpd.conf
  2. Step 2 : Create A Simple PHP file
  3. Step 3 : .htaccess file
    Method 1 – For only a single Variable
    Method 2 – For 1 and more than 1 Variable(s)
  4. Conclusion

Ugly URLs
http://www.visionmasterdesigns.com/demo/seo/test.php?page=page1
http://www.visionmasterdesigns.com/demo/seo/test.php?page=page1&var=foo

Pretty URLs
http://www.visionmasterdesigns.com/demo/seo/page1.html
http://www.visionmasterdesigns.com/demo/seo/page1/foo.html

Click Here to download the script files.

16 Comments