How can add trailing slash if I have two or more subdirectories?

Problem to add trailing slash if I have two or more subdirectories

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

http://example.com/foo/ (with trailing slash, conventionally a
directory)
http://example.com/foo (without trailing slash, conventionally a file)

How can add trailing slash if I have two or more subdirectories ?

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

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,223360,223360#msg-223360

On Monday 05 March 2012 02:50:43 Sputnik wrote:

How can add trailing slash if I have two or more subdirectories ?

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

location ~ [^/]+/[^/]+$ {
    return 301 $uri/;
}

wbr, Valentin V. Bartenev

2012/3/5 Valentin V. Bartenev [email protected]:

location ~ [^/]+/[^/]+$ {
return 301 $uri/;
}

Or this:

location ~ ^[^.]+[^/]$ { return 301 $uri/$is_args$args; }

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs