mcoatney
mcoatney

Reputation: 143

apache 2.4 LocationMatch not catching

I need to set htaccess directives in a virtual host for everything that isn't either / or /example/{anything}. I've looked at everything I can find an it seems like apache is doing something weird with regex I can't figure out why it's not working.

Here is what I am trying, maybe someone can help me.

<Location "/">
  ...
</Location>
<LocationMatch "^(?!/example/.+)$">
 ...
</LocationMatch>

I'm stumped I've been trying different approaches all day.

Adding more to this the positive version of the regex works fine so

<LocationMatch "^(/example/.+)$">

works as expected, just the negative version always fails.

Upvotes: 2

Views: 907

Answers (0)

Related Questions