# Apache <Locationmatch> regex help needed. SOLVED

## msalerno

Hi, I am working on setting up a proxy server using apache that proxies to an internal IIS server. I deny access for specific IP addresses to a location.

I need to block access to the following URL

http://foo.bar/users/examples

Problem 1:

I want to block regardless of trailing slash.

<LocationMatch "^/+users/+examples/*">

The above locationmatch will solve that problem, but open up a new one:

What if I have a Location that's http://foo.bar/users/examplesapps4all that I don't want to restict access to?

I have been working on something like this, but I have had no luck so far.

The below, matches almost perfectly, it just misses http://foo.bar/users/examples

<LocationMatch "^/+users/+examples[^a-zA-Z0-9]">

Does anyone have any suggestions?

Brief example:

http://foo.bar/users/examples - Need to restrict

http://foo.bar/users/examples/ - Need to restrict

http://foo.bar/users/examples/test - Need to restrict

http://foo.bar/users/examplesapps4all - No restriction

http://foo.bar/users/examplesapps4all/ - No restriction

Problem 2:

Since the end server is IIS, the URL's are not case sensitive. In perl, I would end the regex with a /i, but that won't work in this case.

Can a case insensitive match be made with apache's locationmatch?

I know I could solve all of these problems with a re-write rule, but the only problem is that I don't know if it would effect the applications running on the back end, so I need to stay away from it.

Thanks

Here is the solution for the pattern match, I still need to work on a case insensitive match:

<LocationMatch "^/+users/+examples[^a-zA-Z0-9]|^/+users/+examples$">

The solution to the case problem was to use mod_rewrite, and hope that the end servers don't have a problem with it.

----------

