Skip to main content
Exemplified domains according to RFC2606 and to match edited question.
Source Link
MrWhite
  • 43.1k
  • 4
  • 50
  • 90

In order to do a 301 redirect, there needs to be a server at the specified location to reply to the browsersbrowser's request for content with a location like:

HTTP/1.1 301 Moved Permanently
Location: http://www.domainb.comexample

This is necessary because the server has to reply to the browser over HTTP with a response. This kind of redirect cannot be done with DNS because that is not the purpose of DNS.

You might consider setting a CNAME record for DomainA.comDomainA.example with DomainB.comDomainB.example as the value. Your DNS zone might look something like:

NAME                    TYPE   VALUE
--------------------------------------------------
www.domaina.comexample.        CNAME  www.domainb.comexample.
www.domainb.comexample.        A      192.0.2.23

You would also have to ensure that any MX records (tells mail servers where to send email for a domain) for DomainA.comDomainA.example are updated to point to the host at DomainB.comDomainB.example so email can be routed accordingly (if necessary).

In order to do a 301 redirect, there needs to be a server at the specified location to reply to the browsers request for content with a location like:

HTTP/1.1 301 Moved Permanently
Location: http://www.domainb.com

This is necessary because the server has to reply to the browser over HTTP with a response. This kind of redirect cannot be done with DNS because that is not the purpose of DNS.

You might consider setting a CNAME record for DomainA.com with DomainB.com as the value. Your DNS zone might look something like:

NAME                    TYPE   VALUE
--------------------------------------------------
www.domaina.com.        CNAME  www.domainb.com.
www.domainb.com.        A      192.0.2.23

You would also have to ensure that any MX records (tells mail servers where to send email for a domain) for DomainA.com are updated to point to the host at DomainB.com so email can be routed accordingly (if necessary).

In order to do a 301 redirect, there needs to be a server at the specified location to reply to the browser's request for content with a location like:

HTTP/1.1 301 Moved Permanently
Location: http://domainb.example

This is necessary because the server has to reply to the browser over HTTP with a response. This kind of redirect cannot be done with DNS because that is not the purpose of DNS.

You might consider setting a CNAME record for DomainA.example with DomainB.example as the value. Your DNS zone might look something like:

NAME                    TYPE   VALUE
--------------------------------------------------
www.domaina.example.    CNAME  www.domainb.example.
www.domainb.example.    A      192.0.2.23

You would also have to ensure that any MX records (tells mail servers where to send email for a domain) for DomainA.example are updated to point to the host at DomainB.example so email can be routed accordingly (if necessary).

Source Link
Justin Pearce
  • 1.1k
  • 5
  • 11

In order to do a 301 redirect, there needs to be a server at the specified location to reply to the browsers request for content with a location like:

HTTP/1.1 301 Moved Permanently
Location: http://www.domainb.com

This is necessary because the server has to reply to the browser over HTTP with a response. This kind of redirect cannot be done with DNS because that is not the purpose of DNS.

You might consider setting a CNAME record for DomainA.com with DomainB.com as the value. Your DNS zone might look something like:

NAME                    TYPE   VALUE
--------------------------------------------------
www.domaina.com.        CNAME  www.domainb.com.
www.domainb.com.        A      192.0.2.23

You would also have to ensure that any MX records (tells mail servers where to send email for a domain) for DomainA.com are updated to point to the host at DomainB.com so email can be routed accordingly (if necessary).