公司要根据ip跳转到不同网站子平台(仅限首页),于是尝试了下,最终写了两个location,不知道有没有什么简单的写法
location = / {
if ($remote_addr = 192.168.1.1) {rewrite ^(.*)$ http://www.baidu.com/index.html break;
}
}
location = /index.html {
if ($remote_addr = 192.168.1.1) {rewrite ^(.*)$ http://www.baidu.com/index.html break;
}
}