Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Let's say I have mydomain.com and my shared webhost server is 1.2.3.4. My domain registrar and webhosting company are 2 different entities.

Currently I have my DNS records configured like this in my registrar DNS Management section:

A
*.mydomain.com
1.2.3.4

A
mydomain.com
1.2.3.4

CNAME
ftp.mydomain.com
mydomain.com

CNAME
www.mydomain.com
mydomain.com

A
subdomain1.mydomain.com
1.2.3.4

A
subdomain2.mydomain.com
1.2.3.4

A
subdomainN.mydomain.com
1.2.3.4

I have 2 questions/problems:

1) Is there any way to simplify the sub-domain A records so that every time I need to add a new sub-domain to my website I shouldn't have to create a new A record for it in the DNS Management?

2) With the current configuration when the user points to any sub-domain that don't exist (for instance: idontexist.mydomain.com) a default page from cPanel is displayed. I suppose this is the normal behavior? Or should it return a 404 error? If so, how can I make it return a 404 error?

share|improve this question

1 Answer 1

up vote 2 down vote accepted
  1. You've already done it; that * record covers all names not specifically defined.

  2. That message is due to the domain being unconfigured, but the users are still getting sent to your server via the wildcard DNS entry. If there was no DNS covering that subdomain, then they wouldn't make it to your server for cpanel to error or to get a 404 at all; they'd get a browser error that the domain could not be found.

Since all requests for subdomains will come to the web server, probably the best way for you to handle this would be a friendly error page about nothing existing at that location.

share|improve this answer
    
So in 1), I might as well remove the other A records and just leave the * one? As for 2), I don't know if I can modify the default server page. But one question, if I removed the * record and manually added the needed A records, a non existent domain, will now give a 404, right? –  Ricardo Amaral Jun 10 '11 at 2:25
    
Yes, the top two records are all that is needed; the CNAME records aren't doing anything either. It won't give a 404 error, since your web server needs to be reached for that to happen; the user's browser will give an error about the name not being found. –  Shane Madden Jun 10 '11 at 2:29
    
Yes, you're right. Dumb question I did there... –  Ricardo Amaral Jun 10 '11 at 2:34

Your Answer

 
discard

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.