I have a domain example.com
. I’d like to map help.example.com
to example.com
. The DNS records are:
Hostname Type Value
example.com A 93.184.216.34
help.example.com A 93.184.216.34
www.example.com CNAME example.com
I can access the website with both example.com
and www.example.com
but when I try help.example.com
I get 404 Not Found
.:
Not Found
The requested URL / was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
So I’d like to know why is the A
record for help.example.com
not redirecting to example.com
.
Extra information:
-
My .htaccess consists of the single line:
ErrorDocument 404 "Cannot find that URL"
If I try to access
example.com/some_random_string
I get (as expected)Cannot find that URL
. However if I try to accesshelp.example.com/some_random_string
I get the aboveNot Found
message. So it seems that .htaccess is ignored byhelp.example.com
-
Pinging
example.com
,www.example.com
, andhelp.example.com
returns the same IP address. -
I also tried to replace the
A
record with:help.example.com CNAME example.com
But this returns the same
Not Found
message.
2
Answers
There are dots missed in the CNAME record. It should be
So called FQDN (Fully Qualified Domain Name) should be used in CNAME record.
Without the dot nameserver appends the value $origin variable to the end.
Your problem is in webserver configuration. Not in DNS at all.
I assume you use Apache so you need to tell Apache that
example.com
www.example.com
help.example.com
have same root directory.For example if you use VirualHost configuration and Ubuntu then look in
/etc/apache2/sites-enabled/example.com.conf
It should have
If you use other OS/configuration/WebServer you can google/look how your configuration works and where to add your domain name. Not in DNS.