[Tentatively teaching mode on
Main difference between HTTP 301 and DNS CNAME or A record pointing www.oldsdomain.com
with A or CNAME record, browser asking for www.olddomain.com
will either ask proxy (in case of explicit proxy) or resolve www.olddomain.com
to get an IP address then will contact this IP and expect to reach www.olddoamin.com
. This means that web server at this IP must answer to www.olddomain.com
In case of HTTP 301, client (or proxy) will also resolve www.olddomain.com
, reach this IP and get HTTP 301 return code asking browser (or proxy) to redirect to www.newdomain.com
So what's the real difference?
HTTP 301 only looks simpler, no need to deploy temporarily web server for www.olddomain.com
but it doesn't solve some aspects because HTTP 301 works at page level; you could redirect only few pages, not all. But this also means that in case someone accesses short cut to something else than main page where you put your HTTP 301, redirect will not occur.
On the other hand, DNS change will apply at server level.
[teaching - and joking - modes off]