开发者

Make registered users have its own url

I want to build a web application where users can register and have a profile. People can visit the profiles adding the user name in the url like this.

http://mysite.com/john

How can I create this url for each registered user

I taught using mod_rewrite to rewrite the url but are there any 开发者_如何学Pythonother aproaches?

by the way I want to use Struts 2 and tomcat as server


if you wanted to do something like http://bob.mysite.com you could achieve this using wildcard DNS, here is an example of how it can be done on a cPanel server:

http://www.actiononline.biz/web/enabling-wildcard-dns-on-cpanel-servers/

Essentially this allows you to create unlimited amounts of subdomains by parking domains on top of the core domain.


This question/answer combo may help you on the right path: How to do dynamic URL redirects in Struts 2?


Thank you very much. I found this filter http://tuckey.org/urlrewrite/ so I'm going to use it. It works for web applications that use Servlets like Struts, Spring etc.


Here is a silly way, create a directory for each user on the server then put an index.htm or default.htm in it. LOL. This was the way my university setup their web server so that each student could have his own mini website address like http://www.myuni.com/~myuser

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜