有时候我们需要设定一个域名跳转到另一个网址,可以直接在nginx配置文件中指定。
参考下面的配置:
输入www.baidu.com,
返回状态码302。
之后跳转到https://www.qiansw.com/index-1.html
。
server {
server_name www.baidu.com;
location = / {
rewrite ^ https://www.qiansw.com/index-1.html redirect;
}
}
哈哈