Saturday, 8 March 2014

Case-Insensitive Redirect


<LocationMatch "(?i)^/Site/Website(.*)$">
                RedirectMatch "(?i)^/Site/Virtual(.*)$" http://example.com/Site/Virtual

</LocationMatch>

(?i): how we tell the matching engine to treat the text in a case-insensitive manner.

Apache Case-Insensitive Reverse Proxy

Apache ProxyPass directive is case sensitive, this directive differentiates between example.com/Site and same as example.com/site or any of the 16 different permutations (SitE, sITE, ...)

Regex to the rescue:

ProxyPassMatch "(?i)/Site(.*)$" http://192.168.1.1/Site/$1

(?i): case-insensitive match
(.*): zero or more character
$1: trailing text after match sting in the original string. for example (/site/index.html)

Be careful with the trailing /