简体   繁体   中英

IIS Rewrite rule to Block any URL request with and Ampersand

I keep getting requests with an ampersand in the address and it errors. I'm trying to write a URL rule that if the requested URL contains an ampersand, abort the quest. I made a start but it is erroring.

<rule name="Block Amps" stopProcessing="true">
    <match url="*&amp;*" ignoreCase="true" />
    <action type="AbortRequest" />
 </rule>

I tried with both & and & neither seemed to work.

Therefore if the following addresses are requested, they are aborted.

http://www.example/page1&

http://example.com/page1&page2

Try this:

<rule name="Block Amps" stopProcessing="true">
    <match url=".*[&].*" ignoreCase="true" />
    <action type="AbortRequest" />
</rule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM