Welcome to WebmasterWorld Guest from 18.104.22.168
A client owns the .com and the .co.uk variation of a domain. The .co.uk is set up on our server. We told them to set up domain forwarding from .com to .co.uk but they changed the A record instead to point to the server.
I was wondering if, without physically setting the .com on our server we could add something like:
domain.co.uk IN A 22.214.171.124
domain.com IN CNAME domain.co.uk
on our server and if that would solve the issue. Or is that not the way CNAME are used for?
there is no such thing in DNS as a 'redirect'.
A CNAME record is defining an ALIAS name to some other name. And somewhere that aliasing has to end at a real A record.
So having a direct A record in the first place instead of a CNAME is not bad per se, as it would probably save additional lookup overhead.
All records of a domain must be defined in that domain's authoritative zone, so for the two domains involved there are two different zones files, and just defining a foreign 'domain.com.' record within another domain's (domain.co.uk) zone, as you suggest, would have no effect as this would not be seen anywhere.
So what your customer did on his 'domain.com' end looks good to me.
Now that user requests for domain.com end at your HTTP-server, it is up to your HTTP server to handle these, perhaps by setting a HTTP 301 re-direct to avoid duplicate web content problems.
Another way so solve this could be to let the domain.com A record point to a HTTP-server at your customer's end and your customer sends HTTP 301 redirects to your HTTP server.
So to summarize:
- the .com domain has its own DNS records in an own zone file
- the .com name can either point to your server or the customer's
- he who gets that pointer has to set up a HTTP redirect to the other domain then
Hope that helps.