Apache If statement not working
<If "%{REQUEST_URI} =~ m#^abc#">
The REQUEST_URI
server variable always starts with a slash (the start of the URL-path), so the regex m#^abc#
will never match here. You would need to use the regex m#^/abc#
instead. (Assuming that wasn't one of the "different ways" you had already tried?)
I would also avoid splitting your config between the vHost and the server - unless there is a specific requirement to do so? This complicates matters with regards to mod_rewrite as the directives in a virtualhost context will ordinarily override the directives in the server context, so you then need to employ mod_rewrite inheritance (which you are doing) - but this gets unnecessarily messy. (The inherit
option inherits the parent directives behind the current context, which may not be what you are expecting.)
The rest of your question seems to cross-over with your more recent question:
- How to exclude RewriteMap if REQUEST_URI is not found