-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?

3
  • Is there a reason you don't just add a CNAME record to theother.ch's dns? So, "www.theother.ch. 1 IN CNAME mysub.maindomain.ch."
    – cburn11
    Jul 21, 2018 at 22:33
  • CNAME, wild card record, DNAME, pick your (increasing) amount of poison
    – thrig
    Jul 21, 2018 at 22:55
  • CNAME is really the best way to do this.
    – MaQleod
    Jul 22, 2018 at 5:31

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .