skip to Main Content

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 access help.example.com/some_random_string I get the above Not Found message. So it seems that .htaccess is ignored by help.example.com

  • Pinging example.com, www.example.com, and help.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


  1. There are dots missed in the CNAME record. It should be

    help.example.com.   CNAME     example.com.
    

    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.

    Login or Signup to reply.
  2. 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

    <VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName example.com
        ServerAlias www.example.com help.example.com
        ...
    </VirtualHost>
    

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search