Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create many virtual subdomains e.g my original site is but I want that my site users can open my site with the given pattern

Can you please help me for this issue?

share|improve this question

migrated from Sep 16 '11 at 12:45

This question came from our site for professional and enthusiast programmers.

There will be a couple of things that you need to do in this situation. First, you will need to create a wildcard DNS entry. Most DNS server software will allow you to create an A record called * which you can direct to the IP address of your web server. This will cause the DNS server to resolve to the IP address specified. If you have other hostnames, such as specifically defined, those records will override the wildcard (i.e. the wildcard will not negate your existing records or any other record specifically defined).

Second, you will need to configure your web server (I'll presume IIS since you tagged the question with with a binding to the same IP address specified in the DNS record. Do not specify a hostname on this binding. This will cause IIS to catch any request for that IP address which isn't specifically bound to another website entry by its IP/name combination (again, you can have a site bound to the same IP with specific hostnames which will override this one).

Next, in your application code, you will need to handle the incoming request by looking at the variables coming from the server, specifically the SERVER_NAME or HTTP_HOST server variables as they will contain the hostname the user is attempting to access. The code would then reference this hostname back to a user's account and serve up the appropriate content for the hostname in question.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.