Apache LocationMatch regex with subdomain

1.6k Views Asked by At

I'm trying to use LocationMatch to match an URL in a website's second-level subdomain but not in it's third-level subdomain. This is because I want to password protect some URLs at that level.

eg. level2.domain.com/some/url should match but not level3.level2.domain.com/some/url

Than I would apply the necessary directives to password protect the URLs.

Does LocationMatch match this part or the URL ? I don't think so, and if that's the case, what could I use to achieve the desired effect ?

1

There are 1 best solutions below

0
On

I think you have to break up the locations into separate VirtualHost blocks and use ServerName / ServerAlias appropriately to specify the domains you want to cover...