Forum Topic: Redirect match for repeated subdir

Forum: .htaccess Forum : Redirecting • Posted by Steve Jones • Updated:

Hi – a question from a true noob – I hope it’s not too stupid.

Let’s say I’m getting traffic that looks like this:

I want to know if /foo/ appears more than once in the request, and send them off to 403 land if that is the case.

Is that something I can do with RedirectMatch?


Steve Jones

1 Reply to “Redirect match for repeated subdir”

Posted by Jeff Starr

I think it’s possible, try something like this:*)?/foo

This will catch multiple /foo/ requests when the first directory is /foo/, as well as anything like these:

Test thoroughly, tune accordingly :)