We help IT Professionals succeed at work.

resolving old website to new website, using CNAME DNS record

Jeff Hanson
Jeff Hanson asked
on
We are trying to have our old website redirected / resolve to a new domain name which is now hosting the companies current and active website

so users/clients currently trying to access "www.Domain1.com" and getting a 404 page not found error,  as the site is no longer active. We have our new domain available at "www.Domain2.com"

If i go to our domain host management page for Domain1.com, its showing that domain is pointed to the DNS servers our ISP manages. If i then go to our ISP's DNS zone management page, it previously had A records for www.Domain1.com, which have since been removed, and in its place a new CNAME record

the CNAME record is as follows

www.Domain1.com 300 IN CNAME domain2.com

My understanding is that when users try to access www.Domain1.com, it hits our ISP DNS zone, should see the CNAME record and then send back the IP address for www.domain2.com and the user will get the new website

This is not currently working, what am I missing?

Thank you!
Comment
Watch Question

David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
This is handled at the HTTPS level, not DNS level.

Attempting this using CNAME records will fail in subtle ways.

For example, HTTPS (for most browsers + cert authorities) now require A records, so even if you get this to work in some browsers, you'll likely have other browsers fail.

Tip: Handled redirects at the HTTPS level, never the DNS level.

Tip: Always use 302 redirects, never 301 redirects, as you can never reliably change a 301 redirect target... as these values cache forever (infinite TTL) in all browsers.
nociSoftware Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
CNAMES cause the RESOLVER (name -> address translator)  So the new webserver will still get the OLD site name in the header (the browser has no idea of the CNAME).
CERTIFIED EXPERT

Commented:
Depending on who your domain name is registered with, you may be able to do this through them.

Godaddy has an option to forward domain traffic to another domain. All you need to do is set the old domains DNS to use their DNS service (no charge) and park it. Setup the domain forward to where you want traffic to go and you're done
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Best be very careful using Registar domain forwarding as none I've every seen automatically give you a cert for the source domain, so this means eventually all traffic arriving at the source domain will receive a suspicious site message, rather than the redirect, as this test is done in browsers.

Better to use https://LetsEncrypt.org + generate a cert for the source domain, then use a Webserver HTTPS 302 redirect to target domain, as this logic will work correctly.
Scott FellDeveloper & EE Moderator
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2013

Commented:
Domain forwarding can mean different things and I agree with David. Avoid the type of forwarding that godaddy does. Last time I checked that was just framing the current site.  The proper thing to do is bind both domains to your current site and 301 redirect domain1 to domain2.  If your page structure is not the same, this gives you a chance to tell google domain1.com/pagex should be directed to domain2.com/pagey.  

Simply cutting off the domain like you did will probably take a bigger hit as far as seo than setting this up as a redirect.

In other words, point the 'a' record for both domains to the same ip. Add the bindings for the site to accept both domains. Then use your htaccess/web.config to 301 redirect domain1 to domain2. That would be the best option.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.