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?
Answer
You've already done it; that
*
record covers all names not specifically defined.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.
Comments
Post a Comment