Page 1 of 1

URL rewriting using PHP

Posted: Wed Aug 27, 2008 12:11 am
by basudeb
Hi
ALL,

I need a php code using HTACCESS or by any other which will rewrite the URL like http://www.example.com/state1/city1/1236 to the format as http://www.example.com/index.php?state= ... y1&id=1236

Thanks ,
Basudeb

Re: URL rewriting using PHP

Posted: Wed Aug 27, 2008 1:06 am
by pcoder
My requirement is very much similar to yours, i will update you when i get the solutions.
Hope you will also update me.
Does anybody familiar with the .htaccess to get these type of result?

Thanks

Re: URL rewriting using PHP

Posted: Wed Aug 27, 2008 4:16 am
by pcoder
Go through this site:
This stuff is very useful.
http://roshanbh.com.np/2008/03/url-rewr ... ccess.html

Thanks

Re: URL rewriting using PHP

Posted: Wed Aug 27, 2008 9:40 am
by panic!
just create a file in your root directory called .htaccess and put this in there

Code: Select all

 
RewriteEngine On
 
RewriteRule /state(.*)/city(.*)/(.*) index.php?state=$1&city=$2&id=$3