Want to match optional trailing slash


#1

I’m running 1.6.9 built recently with USE_PCRE=1 on my Raspberry Pi. I want to allow the URLs

http://server.mydomain.com/subdir
-or-
http://server.mydomain.com/subdir/

to match

What I tried was

acl mysubdir_req path_beg /subdir/?

using the ‘?’ PCRE regex for “0 or 1” matching but it doesn’t work.

If I remove the ? it does work as long as I include the trailing slash which is what I expected.


#2

path_beg is not a regex.

Use
acl mysubdir_req path_reg ^/subdir/?

or better yet avoid the regex and just write:
acl mysubdir_req path_beg /subdir/ /subdir


#3

Ah! NOT a regex? Well, I’ll have to watch out for that. Thanks!