LocationMatch rules with Apache

1.6k Views Asked by At

I need to fix (with or without regex) so you can access "/admin.php?+" but not "/SUBSITE/admin.php?+" on a site. Anyone has a good idea of how to fix that?

1

There are 1 best solutions below

16
On BEST ANSWER

Here is a regex which might fit your need (your original question was a bit vague):

^(?!www\.mysite\.com\/.*\/admin\.php).*$

I have tested this regex and it blocks "www.mysite.com/*/admin.php", but it allows the following:

www.mysite.com/*/guestbook.php
www.mysite.com/*.php

If you want additional restrictions in the regex, then let me know and I can refine this answer.

Regex101