Apache, LocationMatch: match query string

watain picture watain · Jan 7, 2010 · Viewed 7k times · Source

How can I match a query string using LocationMatch with apache?

<LocationMatch "/index.php\?a=b.*">
// ...

... won't work unfortunately.

Answer

amiuhle picture amiuhle · Dec 5, 2011

Looks like you can't include query strings in Location/LocationMatch.

From the Apache Docs:

For all origin (non-proxy) requests, the URL to be matched is a URL-path of the form /path/. No scheme, hostname, port, or query string may be included. For proxy requests, the URL to be matched is of the form scheme://servername/path, and you must include the prefix.