请问http强制跳转https 如何添加例外 - 有一个文件不跳转

问答中心分类: Nginx请问http强制跳转https 如何添加例外 - 有一个文件不跳转
mike asked 7 年 ago
请问如何添加例外,让有一个文件  page.php 不跳转到https

if ($ssl_protocol = "") { return 301 https://$server_name$request_uri; 
/usr/local/nginx/conf/vhost/www.example.com.conf

1 Answers
oneinstack answered 7 年 ago
尝试以下规则试试:

if ($ssl_protocol = "" && $uri !~ ^/page.php$ ) { return 301 https://$server_name$request_uri;