如何在URl中为2个或更多目录添加尾部斜杠?

如何在URl中为2个或更多目录添加尾部斜杠?,url,nginx,slash,subdirectory,Url,Nginx,Slash,Subdirectory,nginx服务器 如果我有两个或多个子目录,我在添加尾部斜杠时遇到问题 rewrite ^/([^.]*[^/])$ $1/ permanent; //this is working example if I have one directory 如果我有两个或多个子目录,如何添加尾部斜杠 捕获所有不带尾随斜杠的内容,并在其中添加尾随斜杠 rewrite ^(.*[^/])$ $1/ permanent;

nginx服务器 如果我有两个或多个子目录,我在添加尾部斜杠时遇到问题

rewrite ^/([^.]*[^/])$ $1/ permanent; //this is working example if I have one directory
如果我有两个或多个子目录,如何添加尾部斜杠



捕获所有不带尾随斜杠的内容,并在其中添加尾随斜杠

rewrite ^(.*[^/])$ $1/ permanent;