Search Engine Friendly URLs with PHP

Nov 11, 2008 | Tags: SEO, PHP | del.icio.us del.icio.us | digg Digg

1. Introduction

You know that search engines love pretty URLs like:

http://yourdomain.com/Search_Engine_Friendly_URLs_with_PHP

rather than ugly URLs like:

http://yourdomain.com/article.php?id=27&tags=PHP+SEO

Pretty URLs like that are easy for us to read. It will also make your site ranks high in the search results of a search engine. This article explains a very simple trick to achieve this, for your existing site.

The trick consists of several steps:

  1. Give each article a filename
  2. Take advantage from Apache's mod_rewrite
  3. Writing a wrapper script

You can also download a simple demo for this trick. The package contains all necessary files and some installation notes.