|
|
Subject:
How to generate subdomains automatically
Category: Computers > Programming Asked by: lifeproducer-ga List Price: $30.00 |
Posted:
27 Apr 2004 04:43 PDT
Expires: 27 May 2004 04:43 PDT Question ID: 336891 |
My company operates an online service which provides Web page building functions. Now we wants to add new feature giving different subdomains to the members' web pages. Because the number of members is about 120,000, manual configuring is not the solution. Let me give you an example. 1) We have domain name such as '123.com'. 2) Someone joined 123.com with account 'abcd'. 3) He get his own direcory in our Web server such as /htdocs/members/abcd/. (It's url become 'http://www.123.com/members/abcd' and we currently redirect 'http://www.123.com/abcd' to this url.) 4) And he should get the subdomain 'abcd.member.123.com'. (How can we implement this???) About our service environment : Solaris, Oracle, Apache, Tomcat, Java, php, ... I want to know how to implement generating subdomains automatically. If any source codes are available, that will be helpful. | |
|
|
There is no answer at this time. |
|
Subject:
Re: How to generate subdomains automatically
From: gouravjain-ga on 28 Apr 2004 07:35 PDT |
Hi lifeproducer, Basically your soultion is to have virtual domains, you need to create one virtual domain for each of your user in your apache conf file /etc/httpd/conf/httpd.conf. This virtual domain will point the request of 'abcd.member.123.com' to 'http://www.123.com/members/abcd'. You can add the following line in your httpd.conf file to make a virtual domain. <VirtualHost www.123.com> ServerAdmin webmaster@abcd.123.com DocumentRoot /www/docs/abcd.123.com ServerName abcd.123.com ErrorLog logs/abcd.123.com-error_log TransferLog logs/abcd.123.com-access_log </VirtualHost> You can write script in perl or some other language to add the following entry for all the users you have. If you need the help in that then please do write to me. Gourav Jain |
Subject:
Re: How to generate subdomains automatically
From: okrogius-ga on 28 Apr 2004 17:37 PDT |
Alternatively there is one opther option which may be easier to implement under apache (assuming that since you brought up /htdocs/) - wildcard subdomains. You can add: ServerAlias *.example.com In your virtual section of your apache configuration file. Then if someone goes to 116354654653136496841351.example.com they just get your default page, rather then a 404. Finally, make your default page dynamic (PHP or ASP would do fine) to check the domain the page is being accessed under. If the domain isn't wwww.example.com or the like, the page can instantly redirect them to the user's page. For an example of this try yaxay.com. You can go to [member].yaxay.com and get a user's profile page (e.g. test.yaxay.com). |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |