“Nginx: Remove double slashes from URLs nginx去双斜杆”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
 
第16行: 第16行:
 
     }
 
     }
  
 +
 +
 +
#这个应该也是行的
 +
可以通过nginx对多个斜杠进行处理
 +
如访问 public//view//a//test.html 重定向到 public/view/a/test.html
 +
 +
merge_slashes off;
 +
rewrite (.*)//(.*) $1/$2 permanent;
 
</pre>
 
</pre>
  
 
=see also=
 
=see also=
 
[https://gist.github.com/JustThomas/74d04d0ae542b6dab9495bce24c0741c nginx: Remove double slashes from URLs ]
 
[https://gist.github.com/JustThomas/74d04d0ae542b6dab9495bce24c0741c nginx: Remove double slashes from URLs ]

2020年11月4日 (三) 07:35的最新版本

Q

百度云加速出了问题 有些 站出了 dobule slashes

https://m.cailu.net/download

slove


    ssl_prefer_server_ciphers  on;
   # Remove double slashes from URLs
   merge_slashes off;
   rewrite ^([^.]*?\/)\/+(.*)$ $1$2 permanent;

    location / {
   #   proxy_pass http://12.16.20.8:3394;
        add_header X-Frame-Options SAMEORIGIN;
        proxy_pass http://proxy_node_nuxt_mobile.net;
    }



#这个应该也是行的 
可以通过nginx对多个斜杠进行处理
如访问 public//view//a//test.html 重定向到 public/view/a/test.html

merge_slashes off;
rewrite (.*)//(.*) $1/$2 permanent;

see also

nginx: Remove double slashes from URLs