Welcome! Log In Create A New Profile

Advanced

Nginx redirect preserving source hostname

Игнатенко Максим
April 03, 2017 11:06AM
I have an NGINX as reverse proxy with PHP-fpm. Nginx is set up for
serving www.somehost.com. I added another host www.anotherhost.com. Now
I need to setup redirect in this way: If user type www.anotherhost.com
then it redirects to www.somehost.com/someurl, but url in browser bar
shouldn't change. If I set up rewrite it works, but it rewrites url in
browser too.

|if ($host = "www.anotherhost.com") { rewrite ^
http://www.somehost.com/someurl; }|


Is it possible to redirect preserving url ?

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx redirect preserving source hostname

Игнатенко Максим April 03, 2017 11:06AM

Re: Nginx redirect preserving source hostname

Francis Daly April 04, 2017 05:12PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 232
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready