iis - Rewrite Rule Spaces -
i created rewrite rule in iis because of russian spammers rule doesn't seem work correctly because of space between 2 parts search , wondering how overcome this
<rule name="russian referral spam" stopprocessing="true"> <match url=".*" /> <conditions> <add input="{http_user_agent}" pattern="windows+2002|windows+2003|windows+2004|windows+2005|windows+2006|windows+2007|windows+2009" /> </conditions> <action type="redirect" url="https://stackoverflow.com" redirecttype="permanent" /> </rule>
before, never included spaces between windows , fake version:
windows 2002|windows 2004...
and pickup on windows in useragent , redirect them. adding + rule backslash before it's not affecting russian spammers. how change above rule searches 'windows 2002|windows 2004|windows 2005|windows 2006... if in url add %20
here few real examples of russian spam user agents:
mozilla/7.0 (compatible; msie2.00; windows 2005) mozilla/8.0 (compatible; msie3.00; windows 2006) mozilla/6.0 (compatible; msie7.00; windows 2008) mozilla/4.0 (compatible; msie4.00; windows 2005)
i not using apache iis no mod-rewrite rules, please.
thanks in advance
update:
on expert exchange says try windows\ 2006 or windows\s2006. try these waiting spammers return 100% answer know within iis can test rules try also
you correct. space in regexp can use \
or \s
. rule can that:
<rule name="russian referral spam" enabled="true" stopprocessing="true"> <match url=".*" /> <conditions> <add input="{http_user_agent}" pattern="windows\s(2005|2008)" /> </conditions> <action type="redirect" url="https://stackoverflow.com" redirecttype="permanent" /> </rule>
wiki
Comments
Post a Comment