0

What im trying to do:

I have nginx running with wordpress

Now i want DOMAIN-2 to redirect to a path of DOMAIN-1

http://DOMAIN-1/Content-for-Domain-2

but not just a simple redirect, it should change to

http://DOMAIN-2/Content-for-Domain-2

So that users can go to DOMAIN-2 directly if they want to see that content or enter normaly with DOMAIN-1

Any suggestions? I think this should be do-able with rewrite rules?

chillah
  • 101
  • 1
  • 1
  • 5
  • I believe the following would do the trick Source: http://stackoverflow.com/questions/19703772/htaccess-redirect-to-new-domain-with-path-intact-for-both-www-and-non-www-as-we – Rob Wahl Mar 30 '14 at 19:47
  • No, i want the new domain to go to the path of the old domain but with the new domain infront of it. – chillah Mar 31 '14 at 17:58
  • For this you need a CNAME DNS record and setup application to use multiple hosts. See my answer for more detailed info. – phoops Apr 01 '14 at 08:26

1 Answers1

0

To do this first you have to set CNAME DNS records of DOMAIN-2 and point it to DOMAIN-1.

After that, adjust you nginx configuration for your virtual host. You will have your server_name directive defined like this:

server_name DOMAIN-1;

You have to update it to this so nginx also accepts requests for DOMAIN-2:

server_name DOMAIN-1 DOMAIN-2;

E.g.

server_name example.com example.net;
phoops
  • 2,073
  • 4
  • 18
  • 23
  • And how do i end up to only a special path with this setup? I want to be pointed to Domain2.com/path-i-want. This setup you posted will just allow me to go to the homepage of domain 1, isnt it like this? – chillah Apr 01 '14 at 15:38