views:

154

answers:

4

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.

thanks

+6  A: 

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

Matthew Flaschen
+1  A: 

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.

aharon
+4  A: 

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.

Nilloc
Why are you frightened by CF?
Ben Doom
Meh, I'm cheep, it's mostly the licensing fees. Plus I like the python/django-templates community a lot more. And I've been developing on AppEngine more lately.
Nilloc
Solid answer, but weak opinion on ColdFusion ;) You could use the Railo Open Source CFML engine, if you are afraid of licensing costs.
Andreas Schuldhaus
A: 

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.

ppshein