2

I have a problem with the implementation of such redirect:

https://domain.a/ => https://domain.b/foo/

without changing a url to domain.b. I would like to see the contents of the URL domain.a from domain.b/foo/ in browser address bar.

gruntboy
  • 386
  • 2
  • 6

3 Answers3

1

Using proxy pass might works for you

server {
    listen 80;
    server_name domain.a;

    location / {
        proxy_pass https://domain.b/foo;
    }
}
Fajar
  • 111
  • 1
  • Not working - still show domain.b/foo in browser address bar, I would like to show domain.a with content from domain.b/foo. – gruntboy Jan 04 '17 at 11:56
0

Please check the example below :

server {
    listen 443;
    server_name     domain.a domain.b;
    rewrite ^/(.*)$ https://domain.a/ permanent;

    //Rest of your nginx configuration

    }
0

It could be simply achieved by return as well.

location /{
   return 301 https://domain.b/foo/;
}