0

I want to make a redirection from one domain to another but from one page only.

Example: https://domainA.com/site/page to https://domainB.com/site/page

In nginx I put:

location /site {
         rewrite ^/site/page https://domainB.com/site/page break;
}

and it works, it does the rediction, but it changes the url and I want the url to always be https://domainA.com/site/page

How can I do so that the url does not change?

thank you!

2
  • It's not the same domain, it's different. Apr 14 at 8:28
  • I found the solution with "proxy_ssl_server_name on;" Apr 14 at 14:40

1 Answer 1

0

The solution:

location /site/ {
         proxy_ssl_server_name on;
         proxy_pass https://domainB.com/site/page;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.