Basic URL Rewriting
To begin with, let’s consider a simple example. We have a website, and we have a single PHP script that serves a single page. Its URL is:
http://www.pets.com/pet_care_info_07_07_2008.php
We want to clean up the URL, and our ideal URL would be:
http://www.pets.com/pet-care/
In order for this to work, we need to tell the server to internally redirect all requests for the URL “pet-care” to “pet_care_info_07_07_2008.php”. We want this to happen internally, because we don’t want the URL in the browser’s address bar to change.
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^pet-care/?$ pet_care_info_01_02_2003.php [NC,L] # Handle requests for “pet-care”
For detailed options visit this URL
http://www.addedbytes.com/apache/url-rewriting-for-beginners/
Popularity: 2% [?]
