Welcome! Log In Create A New Profile

Advanced

RE: redirect to another domain based on IP address

Reinis Rozitis
May 06, 2019 07:18AM
> We have a website under heavily development. So we divide the site to 3 branches stage, demo and main. What our developers want from me is : "every request from office ip address to main domain must redirect to stage."


If there is a single IP you can use the if directive (http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if ) in case of multiple - map (http://nginx.org/en/docs/http/ngx_http_map_module.html ) or geo will be a better approach.


A generic example with if:

if ($remote_addr = 127.0.0.1) {
return 301 http://stage.aaa.com$request_uri;
}


rr

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

redirect to another domain based on IP address

ender ulusoy May 06, 2019 05:12AM

Re: redirect to another domain based on IP address

Patrick May 06, 2019 06:24AM

Re: redirect to another domain based on IP address

ender ulusoy May 06, 2019 09:20AM

Re: redirect to another domain based on IP address

Patrick May 06, 2019 09:46AM

Re: redirect to another domain based on IP address

ender ulusoy May 06, 2019 09:48AM

Re: redirect to another domain based on IP address

Patrick May 06, 2019 10:10AM

Re: redirect to another domain based on IP address

ender ulusoy May 07, 2019 03:46AM

RE: redirect to another domain based on IP address

Reinis Rozitis May 06, 2019 07:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 281
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready