2012-12-10 71 views
0

有人可以讓我知道爲什麼以下不會重寫正確嗎?在web.config中重定向

<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" /> 

我想這樣重定向了「?levelId =被刪除。

回答

1

我想通了......

<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" />