0

I have a the following directive inside of a <VitrualHost/> directive:

<LocationMatch "api/.*">
.....
</LocationMatch>

I am trying to hit my server with the following URL:

http://localhost/blah/api/blah?....

The stuff inside of my <LocationMatch> directive isn't being match. Maybe I don't understand how <LocationMatch> actually works. I would expect this to look at the URL and compare it with what is inside of the "" of <LocationMatch>.

Edit:

The strange thing is this matches when I end the URL with ../api/

El Guapo
  • 5,581
  • 7
  • 54
  • 82
  • Perhaps, you should use ``? – Wiktor Stribiżew Aug 13 '15 at 13:22
  • sadly that didn't work... thanks though. – El Guapo Aug 13 '15 at 13:29
  • 1
    `LocationMatch` occurs after `` sections, .htaccess files and `` sections, so if you are rewriting the URL then this might not match. The regex `api/.*` is the same as `api/`. – MrWhite Aug 13 '15 at 13:41
  • I've commented out ALL the other and sections. – El Guapo Aug 13 '15 at 13:56
  • How do you test it ? I mean what kind of directives do you have inside the `LocationMatch` container ? – Zimmi Aug 13 '15 at 18:22
  • Basically, I'm just setting a header right now... ultimately I'm going to do some mod_redirect stuff, as well. – El Guapo Aug 13 '15 at 18:54
  • 2
    Does the requested file at `localhost/blah/api/blah` exist? Because headers are set only if a file is returned (an existing file or an existing ErrorDocument). What do you mean with mod_redirect ? If you mean mod_rewrite, it will not work in `Location` or in `Files` containers. – Zimmi Aug 13 '15 at 21:13
  • As the others said -- the expression matches. My guess would be you're rewriting with the [PT] flag, or something similar, and this URL is internally not used for the life of the request. – covener Aug 13 '15 at 23:09
  • Thanks @Zimmi that was the answer I was looking for. – El Guapo Aug 14 '15 at 13:19

0 Answers0