Nginx redirect preserving source hostname

Игнатенко Максим ignatenko at
Mon Apr 3 08:17:19 UTC 2017

I have an NGINX as reverse proxy with PHP-fpm. Nginx is set up for 
serving I added another host Now 
I need to setup redirect in this way: If user type 
then it redirects to, but url in browser bar 
shouldn't change. If I set up rewrite it works, but it rewrites url in 
browser too.

|if ($host = "") { rewrite ^; }|

Is it possible to redirect preserving url ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list