I want to allow /myapp
and /myapp/
but disallow everything else. How do I configure this? I tried this:
<LocationMatch "^/myapp/.+$">
LDAP here
</LocationMatch>
Which I would assume would NOT hit /myapp
or /myapp/
, but it appears that captures those URLs as well.
If I do
<LocationMatch "^/myapp/specificsubdirectory/.*$">
LDAP here
</LocationMatch>
Then this works, but I want to block off all specific subdirectories in the app.
DirectoryIndex is applied before LocationMatch, rewriting the location to end with the directory index file (index.html, index.php and so on). Your pattern
matches, because it's actually applied to
The regular expression is wrong. Try a
pcretest(1)
:So a working
<LocationMatch>
directive would be: