URL rewriting using PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
basudeb
Forum Commoner
Posts: 44
Joined: Wed Dec 20, 2006 12:13 am

URL rewriting using PHP

Post 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
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: URL rewriting using PHP

Post 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
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: URL rewriting using PHP

Post by pcoder »

Go through this site:
This stuff is very useful.
http://roshanbh.com.np/2008/03/url-rewr ... ccess.html

Thanks
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: URL rewriting using PHP

Post 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
 
 
Post Reply