nginx https强制跳转到http

ZephyrXT 发布于 阅读:31

由于某种原因不再使用ssl链接,使原有的https索引跳转到http

server
{
listen      443;
server_name zephyrxt.com www.zephyrxt.com ;
index index.html index.htm index.php default.html default.htm default.php;
root  /home/wwwroot/zephyrxt.com;
ssl on;
ssl_certificate zephyrxt_com.crt;
ssl_certificate_key zephyrxt.pem;
rewrite ^(.*) http://zephyrxt.com/$1 permanent;

access_log  off;
}

 http://zephyrxt.com/$1 permanent;

access_log  off;
}

 http://zephyrxt.com/$1 permanent;

access_log  off;
}

 http://zephyrxt.com/$1 permanent;

access_log  off;
}

 /usr/local/nginx/sbin/nginx -t
 /usr/local/nginx/sbin/nginx -s reload

跳转效果在线监测:http://www.seoconsultants.com/tools/check-server-headers-tool/#Report

apache 301跳转:

RewriteCond %{HTTPS} !on [NC]
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

参考:

nginx 下 强制 http 转向 https
https://bbs.zephyrxt.com/forum.php?mod=viewthread&tid=3677&fromuid=6
URL重写规则
https://bbs.zephyrxt.com/forum.php?mod=viewthread&tid=4469&fromuid=6

nginx/apache 中防止绑定别人恶意解析过来的域名
https://bbs.zephyrxt.com/forum.php?mod=viewthread&tid=4472&fromuid=6
修改 .htaccess 实现 301 重定向
https://bbs.zephyrxt.com/forum.php?mod=viewthread&tid=4471&fromuid=6

Nginx下301重定向域名
https://bbs.zephyrxt.com/forum.php?mod=viewthread&tid=4200&fromuid=6