Tutorial :username urls like twitter and facebook


how does twitter and facebook etc. make unique url eg. twitter.com/billgates

if i would like to do the same (give my users unique urls with username), is it a application or do you crate a directory for each user with a index page??

by the way im using coldfusion.



More generally these online services (Facebook, Twitter, any site that stores a username) use a database and tests for so see if the username is unique at the time of creation. Usually by querying the name before allowing the new account to be created (many do this with ajax requests as the user enters the name in the signup form).

Once the account is created then the server can be set up to handle the path name (using something like mod_rewrite) when a URL request is received, and pass along the information to a script that then accesses that user's information in the database and renders the page.

This blogpost & video seem to be pretty helpful but since I'm not sure what your setup is it should at least point you in the right direction... Also Coldfusion scares me.


There wouldn't be an actual directory. Typically, these apps use mod_rewrite or equivalent to map the URLs.


I'm not that familiar with CF, but the way Facebook does it (in affect) is have an Apache rewrite rule that redirects pages that match /text3423 to /profile.php?username=text3423 (not really, but that's the basic implementation.)

Twitter uses the routing of Ruby on Rails, so really, there are no actually directories at all. It just maps /* to their user feed page.


You can't use like that in Coldfusion anyway but you can use like http://cftwitter.com/index.cfm/username/billgates.

Fortunately, SEO feature is supported in IIS7. You can try and test.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »