Jump to content


Photo

Giving Profile link a personal url


  • Please log in to reply
5 replies to this topic

#1 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 09 May 2006 - 01:15 PM

You know how myspace let's you pic your own url? (myspace.com/myname)

How do I impliment that on my own site.

I currently have the profiles set up as profile.php?userid=usernumber

#2 rt-box

rt-box
  • Members
  • Pip
  • Newbie
  • 6 posts
  • LocationParis, France

Posted 09 May 2006 - 01:26 PM

[!--quoteo(post=372570:date=May 9 2006, 03:15 PM:name=cmgmyr)--][div class=\'quotetop\']QUOTE(cmgmyr @ May 9 2006, 03:15 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
You know how myspace let's you pic your own url? (myspace.com/myname)

How do I impliment that on my own site.

I currently have the profiles set up as profile.php?userid=usernumber
[/quote]
You need to have mod_rewrite enabled in Apache and configure it so that when www.example.com/myname is called, it loads profile.php?username=myname.
In that case your users must have unique usernames.
You can refer to [a href=\"http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html\" target=\"_blank\"]the Apache website[/a] for mod_rewrite documentation. It's fairly straightforward.

#3 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 09 May 2006 - 01:37 PM

Cool. Thanks! I will check it out.

#4 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 09 May 2006 - 02:01 PM

Another question...

How do I make this dynamic to where they have a little text box and they type in the name they want, and after it is verified, then it goes and makes the redirect?

#5 rt-box

rt-box
  • Members
  • Pip
  • Newbie
  • 6 posts
  • LocationParis, France

Posted 09 May 2006 - 02:14 PM

[!--quoteo(post=372595:date=May 9 2006, 04:01 PM:name=cmgmyr)--][div class=\'quotetop\']QUOTE(cmgmyr @ May 9 2006, 04:01 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Another question...

How do I make this dynamic to where they have a little text box and they type in the name they want, and after it is verified, then it goes and makes the redirect?
[/quote]
You only need to figure out a generic RewriteRule so that all URLs matching <http://www.example.com/anyname> (and only those URLs) will point to [a href=\"http://www.example.com/profile.php?username=anyname\" target=\"_blank\"]http://www.example.com/profile.php?username=anyname[/a]. As the documentation shows, you just have to figure out what's the regexp for that.
Once you have done that, when a user registers, you just need to check whether they want an existing username, and register it normally. Since the redirect will work for any name, there's nothing else to do on that side. You also have to change your profile.php page so that if someone comes to [a href=\"http://www.example.com/unknown_username\" target=\"_blank\"]http://www.example.com/unknown_username[/a], the profile.php either throws a 404 page, or nicely tells the client that he probably misspelled the name.

#6 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 09 May 2006 - 02:58 PM

ok thanks again!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users