treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] htaccess rewrite

  • Hi everyone!

    My question is about htaccess rewrite (I think that's what I'm trying to do).

    Do you know how facebook allows user to have their own facebook.com/username address? How do they do this with so many members? Is /username just pointed to profile.php?id=00000023201302?

    Any ideas on how they do this? Do they keep a database of usernames?

    Thanks!
  • Maybe they do it like this: RewriteRule ^/username /profile.php?id=idofuser
    and they include a check if somewhere in the domain's name is the id of the user or if it is the specific adress and if a specific adress is set but your are accessing the profile.php page they redirect you to the specific address, where the redirect won't be done. However I think that's not the way facebook does it, because you can call http://facebook.com/10000243532421 and it will redirect you to your profile.php or if set your specific address.
    For what do you need this information btw?