I currently have a domain example.com
and a subdomain sub.example.com
. What I am trying to do is to make them accessible with www
, that is, www.example.com
and www.sub.example.com
. The records look like this (using Namecheap here so not editing the raw zone-file)
Type Host Value
A @ <ip-addr>
A sub <ip-addr>
CNAME www example.com.
CNAME www sub.example.com.
While example.com
, sub.example.com
and www.example.com
is accessible, www.sub.example.com
isn't, what am I doing wrong?
You need:
CNAME www.sub example.com.
Explanation:
(since the domain is example.com
, it will be appended to any Host
not ending with .
)
A @ <ip-addr>
means example.com
=<ip-addr>
A sub <ip-addr>
means sub.example.com
=<ip-addr>
CNAME www example.com.
means www.example.com
=example.com
(resulting in www.example.com
=<ip-addr>
)
CNAME www sub.example.com.
means www.example.com
=sub.example.com
(resulting again in www.example.com
=<ip-addr>
, so this last one is obviously rendundant and can be removed)
So, you have no www.sub.example.com defined anywhere, and any one of these would work:
CNAME www.sub example.com.
CNAME www.sub sub.example.com.
CNAME www.sub www.example.com.
A www.sub <ip-addr>