简体   繁体   中英

Redirect in web.config

Can someone please let me know why the following will not rewrite correctly?

<rule name="Redirect account listing with levelId" stopProcessing="true">
<match url="^account/([^/]+)/([^/]+)/([^/]+)[?levelId=]$" />
<conditions>
  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="account/{R:1}/{R:2}/{R:3}" appendQueryString="false" />

I'm trying to redirect so that the "?levelId= is removed.

I figured it out...

<rule name="Redirect account listing with levelId b" stopProcessing="true">
<match url="^account/([^/]+)/([^/]+)/([^/]+)" />
<conditions>
  <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
  <add input="{QUERY_STRING}" pattern="^levelID=([^=&amp;]+)$" />
</conditions>
<action type="Redirect" url="account/{R:1}/{R:2}/{R:3}" appendQueryString="false" />

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