I have a website hosted on the following path: mywebsite.com/test with the following DNS
mywebsite.com A 1.2.3.4 (host ip)
host.mywebsite.com A 1.2.3.4 (host ip)
On another domain I'm trying to make a subdomain CNAME redirect to this page using the following:
link.myotherdomain.com CNAME . mywebsite.com/test
However when I access link.myotherdomain.com it shows the host.mywebsite.com instead of mywebsite.com
I'm doing something wrong?
Thanks
CNAME record cannot include path. It only for domin to domain. This setting will work.
If configured properly, all of
mywebsite.com
host.mywebsite.com
link.myotherdomain.com
are resolve to1.2.3.4
, then the following HTTP request is sent to IP address1.2.3.4
.Now, the most suspiicious element is the Virtual Host setting of webserver. This is a function of the web server that behaves as if it is a different server according to the Host value in the request header.
To survey about Virtual Host, the following might be the most simple method.
curl -H 'Host:mywebsite.com' http://1.2.3.4/test
// this will okcurl -H 'Host:link.myotherdomain.com' http://1.2.3.4/test
// this will not ok if Virtual Host enabled