时间:2021-02-04日 来源: 作者: 
nginx版本为1.1.19。
若域名由a.com转移到了b.com,并对两个域名有所有权,可以:
	复制代码代码如下:
	
		
		server{
		    server_name a.com;
		    return 301 $scheme://b.com$request_uri;
		}
重启服务器,然后看一下成功与否:
	复制代码代码如下:
	
curl -I a.com
 
 
curl -I a.com
	
	
	nginx子目录301重定向设置方法
如我想把www.b.com/bfiles/download/转向到dx1.b.com:81/bfiles/download/下,nginx下网站的conf文件里这些写:
	复制代码代码如下:
	
location ~* ^/bfiles/download/ {
rewrite ^/bfiles/download/(.*)$ http://dx1.b.com:81/bfiles/download/$1 permanent;
}
location ~* ^/bfiles/download/ {
rewrite ^/bfiles/download/(.*)$ http://dx1.b.com:81/bfiles/download/$1 permanent;
}
相关文章
推荐文章
热门文章
