某些歷史遺留問題,可能鏈接中有出現雙斜槓或者是多斜槓現象,需要去掉多餘的只保留1個斜槓。
Nginx直接再server或者是對應的位置加上下面兩行配置即可
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://nginx-A;
}
//去除多斜槓的配置
merge_slashes off;
rewrite (.*)//(.*) $1/$2 permanent;
}
示例:
去除前:http://localhost//aa///b////c
去除後:http://localhost/a/b/c