Can LocationMatch Regex match Query String portion?
I am trying to use LocationMatch regex to try to match when a certain file is uploaded or downloaded through an application. The application uses query strings in the URL.
The request:
"POST /uploads.js?attachment_id=2&filename=issues%20(12).csv&content_type=application%2Fvnd.ms-excel HTTP/1.1" 200 336
I am noticing that the Regex doesn't seem to be able to see query string characters that come after the "?" in the URL.
Is that correct? and Why?
Is there a way to be able to Regex match whats in the query string portion?
Solution 1:
Actually it's possible since Apache 2.4 (or less) using the tag as follow :
<LocationMatch "/test/upload.js">
<If "%{QUERY_STRING} =~ /query=test/">
..
'Your directives'
..
</If>
</LocationMatch>
In this configuration directives will be applied only in the case the URL is under the form "/test/upload.js" and contains the query "query=test".