-1

I have a homepage with a subdomain. For example "mysub.maindomain.ch". Now I want to redirect another domain "www.theother.ch" to this subdomain.

In fact: "www.theother.ch" should open "mysub.maindomain.ch".

Can I achieve this with DNS records?

What I got so far: "www.theother.ch" opens "www.maindomain.ch". but how can I open the subdomain?

Joehl
  • 109
  • 4

1 Answers1

1

Option 1:

CNAME www.theother.ch to point to mysub.maindomain.ch. People will go to www.theother.ch in their web browser, the web browser will always show www.theother.ch in the address bar, but will pull content from the web server that's serving mysub.maindomain.ch. Of course, you'll need to tell the web server software at mysub.maindomain.ch to respond to www.theother.ch. HTTP headers will show the original domain that was requested, regardless of where the CNAME record ultimately ends up (you can CNAME to a CNAME to a CNAME to a CNAME but the very first CNAME is what's used in the HTTP header).

Option 2:

Have an A record point www.theother.ch to the same IP address as the web server that hosts mysub.maindomain.ch. Tell the web server software to accept requests for www.theother.ch but then HTTP 301 redirect people to mysub.maindomain.ch.

Wesley
  • 32,690
  • 9
  • 82
  • 117