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.

3 Answers 3

1

Using proxy pass might works for you

server { listen 80; server_name domain.a; location / { proxy_pass https://domain.b/foo; } } 
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. Commented Jan 4, 2017 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 } 
8
  • Thx but not working - still appears domain.b/foo in browser bar Commented Jan 4, 2017 at 11:10
  • From your question "Nginx redirect/rewrite domain.a to domain.b/foo/ without changing url", isn't it correct? Commented Jan 4, 2017 at 11:18
  • At the moment, after entering the domain.a appears in the address bar domain.b/foo/. I would like to after entering the domain.a appeared content from domain.b/foo/ without changing the address in my browser from domain.a to domain.b/foo/. Commented Jan 4, 2017 at 11:27
  • Okay, when you enter domain.a on browser, you should get the contents from domain.b/foo on browser. Is that correct? Commented Jan 4, 2017 at 11:31
  • exactly! and "you should get the contents from domain.b/foo on browser." without change url, I would like to domain.a was still visible in the address bar. Commented Jan 4, 2017 at 11:44
0

It could be simply achieved by return as well.

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

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.