这个想法是添加一个规则到我的iis(版本7)来redirect这个
http://www.mydomain.com/folder/Default.aspx?&variable1=eeee&variable2=aaa
至:
http://www.mydomain.com/folder/Default.aspx?&variable1=ffff&variable2=gggg
但它必须只与这个具体的url和所有的url必须保持相同的事情
我读这篇文章http://blogs.iis.net/bills/archive/2008/05/31/urlrewrite-module-for-iis7.aspx但是为模式和所有的url,这是一个特定的url
谢谢!
尝试这个:
<configuration> <system.webServer> <rewrite> <rules> <rule name="MyRule" patternSyntax="ECMAScript" stopProcessing="true"> <match url="^folder/Default.aspx$" /> <action type="Redirect" url="folder/Default.aspx?&variable1=ffff&variable2=gggg" appendQueryString="false" redirectType="Found" /> <conditions logicalGrouping="MatchAny"> <add input="{QUERY_STRING}" pattern="^&variable1=eeee&variable2=aaa$" /> <add input="{QUERY_STRING}" pattern="^variable1=eeee&variable2=aaa$" /> </conditions> </rule> </rules> </rewrite> </system.webServer> </configuration>
将<action>元素中的redirectType属性设置为以下之一:
Permanent的301 Permanentredirect Found 302 Foundredirect 这涵盖了查询string的可能性:
&variable1=eeee&variable2=aaa – 按照您的示例,带领导符号
或与领先的&符:
variable1=eeee&variable2=aaa
如果你只想直接重写而不做redirect,那么把<action>元素改为:
<action type="Rewrite" url="folder/Default.aspx?&variable1=ffff&variable2=gggg" appendQueryString="false" />