我已经有这个301重定向工作,但我需要留下一个网址模式,所以它是由http服务。现在我使用的是:
server {
listen 80 default;
server_name example.com www.example.com;
return 301 https://www.example.com$request_uri;
}我在返回之前尝试了一下:
location /wp-json {
return 301 http://www.example.com$request_uri;
}但这并不管用。我需要任何以http://www.example.com/wp-json/*开头的网址不要通过HTTPS重定向。
发布于 2017-08-23 13:41:30
试试这个:
server {
listen 80 default;
server_name example.com www.example.com;
# Redirect to HTTPS, unless it begins with /wp-json/
if ($uri !~* "^/wp-json/") {
return 301 https://www.example.com$request_uri;
}
}https://stackoverflow.com/questions/45829173
复制相似问题