How to exclude specific addresses in nginx's rewrite rules
仅有的幸福
仅有的幸福 2017-05-16 17:07:55
0
2
744

How can rewrite rules exclude specific paths?
For example, the entire site uses HTTPS, but /XXX/ does not use HTTPS
By rewriting ^(.*) https://$host$1 permanent; you can all jump to the https address, but among them http What should I do if I don’t want to force HTTPS for all content at ://abc.com/XXX/? Because some clients do not support HTTPS, they cannot all be banned at once.

仅有的幸福
仅有的幸福

reply all(2)
某草草

Just put it in front, refer to the code

location /XXX/ {
   index index.php;
}

location / {
    rewrite ^(.*) https://$host permanent;
}
我想大声告诉你

First use location to exclude the exception path, and then do rewrite.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template