Reputation: 21
I am trying to create some rewrite rules (IIS7 ReWrite Module) for drive-by attempts to hack the website.
My problem is that I like to keep my 404 stat clean, but currently it is filled with URL's containing "wp-admin", "fckeditor" and software like that.
I would like to make a ReWrite if the URL contains some specific words somewhere in the URL. So far I made this one that works fine. It look for the word "wp-admin" somewhere in the URL and just rewrites to the homepage.
<rule name="Handle Hacks" stopProcessing="true">
<match url=".*wp-admin.*" />
<conditions logicalGrouping="MatchAll" />
<action type="Rewrite" url="/" />
</rule>
This solution requires a seperate rule for each word. Is there a way to create just one rule that can do the trick with "wp-admin", "fckeditor", "administrator" ect.?
Thanks
Upvotes: 2
Views: 1568
Reputation: 8736
You can use OR (symbol |
) in your regexp like that:
<rule name="Handle Hacks" stopProcessing="true">
<match url="(wp-admin|fckeditor|administrator)" />
<action type="Rewrite" url="/" />
</rule>
Upvotes: 0