create a sub website of the parent website for eac

2019-05-21 04:15发布

问题:

My client asked me to create a new sub folder or sub directory for each user. My main URL is like www.mysite.com, after creating a user the user should be able to access it as www.mysite.com/userName or www.userName.mysite.com. Is it possible to do through JSP, i dont know exact what key words should be used to search in google for this problem. I use JSP, Apache tomcat 5.5, mysql 5.0 for my development. Do i have to copy all the contents to subfolder do this? If so where i could get some help or tutorial?

回答1:

that can be done in httpd.conf e.g.

ServerName www.userName.mysite.com
RewriteCond %{HTTP_HOST} ^www\.userName\.mysite\.com$ [NC]