dynamic link creation

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
sshaham1
Forum Newbie
Posts: 2
Joined: Sun Jan 16, 2011 10:09 am

dynamic link creation

Post by sshaham1 »

How do websites like facebook and formspring dynamically make subdirectory links for their new users?

for example, if i sign up on formspring and my username is USA1992, the link to my profile is formspring.me/USA1992

how do websites do that?
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: dynamic link creation

Post by Jonah Bron »

You need to use url rewriting to map (for example) "http://example.com/bob123" to "http://example.com/user.php?user=bob123". Then you can use $_GET['user'] in user.php to bring up that user's profile.

http://www.google.com/search?q=php+url+ ... g+tutorial
Peter Kelly
Forum Contributor
Posts: 143
Joined: Fri Jan 14, 2011 5:33 pm
Location: England
Contact:

Re: dynamic link creation

Post by Peter Kelly »

Use Mod_Rewrite have a look at http://www.easymodrewrite.com for guidance
Post Reply