0

A mod_alias newbie here.

I found the rewrite rule below somewhere and have been using it to block bots and hackers that hit my site, looking for directories like HNAP1, wp, blog, etc.

And it works for that, returning a Forbidden 403 message.

<IfModule mod_alias.c>

RedirectMatch 403 /(\{\$itemURL\}|cro|HNAP1|wp|blog|)/?$

</IfModule>

But how do I also redirect /wp/wp-admin/ and /blog/wp-admin/ to a 403 message? And any other subdirectory, i.e. /wp/wp-admin/subdirectory/ ?

markratledge
  • 519
  • 5
  • 13
  • 26

1 Answers1

1

You should be able to add more patterns:

RedirectMatch 403 /(\{\$itemURL\}|cro|HNAP1|wp|blog|wp/wp-admin|blog/wp-admin|wp/wp-admin/.+|)/?$

Hope this helps.

Belmin Fernandez
  • 10,799
  • 27
  • 84
  • 148