Simple rewrite (redirection)

Igor Sysoev igor at sysoev.ru
Thu Nov 24 10:07:33 UTC 2011


On Wed, Nov 23, 2011 at 02:46:13PM -0500, EricTheRed03 wrote:
> Hi Guys,
> 
> In my HTTP config section in the config file, I would like to implement
> a redirection based on this scenario:
> 
> If the URL is not "http://sitea.com/exactmatch" then redirect to the
> "https" home. else go to our hidden url (our testing boxes)
> 
> #logic would be somthing like this..
> If (The URL is anything but "/ahiddenurl") 
> {
>         go to "https://sitea.com"
> }
> else 
> {
>       go to "http://hiddenurl"
> }
> 
> Is this possible in the nginx.conf file?? Any help would be so very much
> appreciated!

server {
    listen       80;
    server_name  sitea.com;

    location / {
        return https://sitea.com;
    }

    location /hiddenurl {
        ...
    }
}


-- 
Igor Sysoev



More information about the nginx mailing list