0

nginxサーバー2つ以上のサブディレクトリがある場合、末尾にスラッシュを追加する際に問題が発生します

rewrite ^/([^.]*[^/])$ $1/ permanent; //this is working example if I have one directory

2つ以上のサブディレクトリがある場合、末尾にスラッシュを追加するにはどうすればよいですか?

http://example.com/foo/foo2/
http://example.com/foo/foo2/

4

1 に答える 1

0

末尾のスラッシュがないものをすべてキャプチャし、末尾のスラッシュを追加します。

rewrite ^(.*[^/])$ $1/ permanent;
于 2012-03-06T22:07:26.773 に答える