Redirect without changing base server name??

mike mike503 at gmail.com
Wed May 14 22:40:15 MSD 2008


Could it be

"server_name_in_redirect off;"

?

On 5/14/08, Ed W <lists at wildgooses.com> wrote:
> Hi, I have a site which hosts several domains and they are all redirected to
> a single vhost.  I then want to redirect "/" to some starting URL, but when
> I do so the hostname in the URL changes to the first server name in my
> config, rather than staying the same as the user requested
>
> eg, user goes to "http://webmail.theirsite.com/" and it should redirect to
> "http://webmail.theirsite.com/src/login.php", but what
> actually happens is that it goes to
> http://webmail.genericsite.com/src/login.php
>
> Config:
>
>       server {
>         server_name webmail.genericsite.com webmail.theirsite.com
>         rewrite ^/$ /src/login.php redirect;
>         etc
>      }
>
> Suggestions please on how to fix this?  (Use an IF perhaps?  Seems ugly?)
>
> Ed W
>
>





More information about the nginx mailing list