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 would like to achieve something similar to what does - giving each user its own subdomain. would in the VirtualHosts setup of Apache would have its DocRoot at /user/user1, for instance.

Now, our hosting service provider takes a fee for creating a domain, and in our case this would mean a ridiculous number of domains with a matching price. After some googling on DNS I came over a description of a DNAME record. That seems to fit the bill precisely. Any reason why my service provider would not do this, or why I should not do this?

share|improve this question
If your hosting provider charges a fee for creating a subdomain (e.g. user1.mydomain.tld, the new domain being the user1 part), then switch hosting provider. It's almost a steal. – gparent Jun 21 '12 at 14:32
up vote 4 down vote accepted

In my personal opinion, you need to switch hosting providers. If I understood you correctly, they are charging for subdomains which are otherwise completely free to create and use.

Anyway, no, there should be no additional cost for inserting this entry (other than the one they appear to charge). They only reason they wouldn't do this is so they can profit from the fact you cannot be bothered to get a better deal elsewhere. I do not know of a server setup that wouldn't support this very simple feature (that is, Apache and Bind support it out of the box).

How to do it:

A * record need not be a DNAME record specifically. What you essentially want is just a normal A record that points * to (where the IP represents the shared IP the website is hosted on. If you're not sure what it is, just look at your IN A record - it has to resolve to it):

*   IN   A

and then Apache will take it from there, just setup the VirtualHost to have the correct entry (I think it's ServerName) to be * and everything will match correctly (i.e. it'll load the correct DocumentRoot).

Just so you know: you cannot circumvent the fact that Apache will need to be (manually) configured. Some hosting providers may not do this, and if they don't, leave!

share|improve this answer
Then what is the difference between an A record and a DNAME record? From I get the impression that there is 1:1 correspondance between an ip and a hostname, whereas a DNAME is like a CNAME, except that it can point to include multiple subdomains (such as * – oligofren Jun 21 '12 at 14:39
The effect of them, in this case, would be the same. However, you should be aware that when a lookup is made for, it will DNAME to - but this is still not an IP address. A futher DNS lookup will be made (analogous to resolving a CNAME) to convert into its IP via the A record. This extra step is good if you only want to update a single record when you change IPs, but I think overall the overhead is not worth it if you only have 2 records (* and – Jay Jun 21 '12 at 14:44
Aha, actually, I missed the point where DNAME refers to hostnames, whereas A records refers to ips. Thanks! – oligofren Jun 21 '12 at 15:05

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.