In the httpd.conf I would like to allow a main path but disallow a particular subfolder.
Any url with this pattern must be accepted:
/app-1.0/public
/app-1.0/images
/app-1.0/
but this one must be ignored / not allowed.
/app-1.0/private
I want to use this configuration on an apache version 2.2.3. I have read that that version does not support negatives regex, but I am not sure.
Many thanks in advance.
If you want to disallow any paths that start with
/app-1.0/and then haveprivate, you can useSee the regex demo
Pattern explanation:
^-start of string (remove if the text is not at the start)/app-1\.0/- a literal/app-1.0/text (the dot must be escaped to be treated as a literal dot)(?!private)- a negative lookahead that fails the match (=disallows) if there is aprivatetext right after the current position.*- any 0+ characters other than a newlineNOTE: In my original comment, I suggested
/app-1\.0/(?!private$).*pattern with a$afterprivate. That pattern disallows (=does not match) a string that contains/app-1.0/privateat the end ($is the end-of-string anchor).