username urls like twitter and facebook

2019-02-11 05:47发布

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

4条回答
唯我独甜
2楼-- · 2019-02-11 06:12

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.

查看更多
倾城 Initia
3楼-- · 2019-02-11 06:16

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

查看更多
劳资没心,怎么记你
4楼-- · 2019-02-11 06:19

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.

查看更多
啃猪蹄的小仙女
5楼-- · 2019-02-11 06:23

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.

查看更多
登录 后发表回答