Redirect without changing base server name??

Ed W lists at wildgooses.com
Wed May 14 19:36:43 MSD 2008


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