Nginx上設置301和302跳轉

301跳轉(由abc.com跳轉到def.com):

server {
listen 80;
server_name abc.com;
rewrite ^/(.*) http://def.com/$1 permanent;
access_log off;
}

302跳轉(由abc.com跳轉到def.com):

server {
listen 80;
server_name abc.com;
rewrite ^/(.*) http://def.com/$1 redirect;
access_log off;
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注