URL重写重定向错误
URL Rewrite Redirect error
我正在尝试使用 URL 重写来获得在 IIS 8 中工作的非常简单的 URL 重定向。我需要重写这个 URL:
http://test.asystyou.com/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/305
对此:
http://test.asystyou.com/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/30
我至少用 6 种不同的方式编写了规则,但都失败了。
第一个版本
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^http:\//test.asystyou.com\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/305$" />
<conditions>
</conditions>
<action type="Redirect" url="http://test.asystyou.com/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/30" appendQueryString="false" />
</rule>
第二个版本
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^305$" />
<conditions>
<add input="{HTTP_POST}" pattern="^http:\//test.asystyou.com\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/$" />
</conditions>
<action type="Redirect" url="http://test.asystyou.com/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/30" appendQueryString="false" />
</rule>
第三个版本
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^305$" />
<conditions>
<add input="{HTTP_POST}" pattern="^\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/$" />
</conditions>
<action type="Redirect" url="/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/30" appendQueryString="false" />
</rule>
第四版
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^305$" />
<conditions>
<add input="{HTTP_POST}" pattern="^http:\//test.asystyou.com\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/$" />
</conditions>
<action type="Redirect" url="30" appendQueryString="false" />
</rule>
第五版
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^305$" />
<conditions>
<add input="{HTTP_POST}" pattern="^http:\//test.asystyou.com\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/$" />
</conditions>
<action type="Redirect" url="{C:0}/30" appendQueryString="false" />
</rule>
第六版
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^305$" />
<conditions>
<add input="{HTTP_POST}" pattern="^\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/$" />
</conditions>
<action type="Redirect" url="{C:0}/30" appendQueryString="false" />
</rule>
这些都失败了。我错过了什么?
这条规则将为您分叉:
<rule name="RestaurantDirect" stopProcessing="true">
<match url="Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/305$" />
<action type="Redirect" url="/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/30"/>
</rule>
我正在尝试使用 URL 重写来获得在 IIS 8 中工作的非常简单的 URL 重定向。我需要重写这个 URL:
http://test.asystyou.com/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/305
对此:
http://test.asystyou.com/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/30
我至少用 6 种不同的方式编写了规则,但都失败了。
第一个版本
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^http:\//test.asystyou.com\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/305$" />
<conditions>
</conditions>
<action type="Redirect" url="http://test.asystyou.com/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/30" appendQueryString="false" />
</rule>
第二个版本
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^305$" />
<conditions>
<add input="{HTTP_POST}" pattern="^http:\//test.asystyou.com\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/$" />
</conditions>
<action type="Redirect" url="http://test.asystyou.com/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/30" appendQueryString="false" />
</rule>
第三个版本
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^305$" />
<conditions>
<add input="{HTTP_POST}" pattern="^\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/$" />
</conditions>
<action type="Redirect" url="/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/30" appendQueryString="false" />
</rule>
第四版
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^305$" />
<conditions>
<add input="{HTTP_POST}" pattern="^http:\//test.asystyou.com\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/$" />
</conditions>
<action type="Redirect" url="30" appendQueryString="false" />
</rule>
第五版
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^305$" />
<conditions>
<add input="{HTTP_POST}" pattern="^http:\//test.asystyou.com\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/$" />
</conditions>
<action type="Redirect" url="{C:0}/30" appendQueryString="false" />
</rule>
第六版
<rule name="RestaurantDirect" stopProcessing="true">
<match url="^305$" />
<conditions>
<add input="{HTTP_POST}" pattern="^\/Restaurant\/Made-Main-Street\/1990-Main-St-112-Sarasota,-FL-34236\/$" />
</conditions>
<action type="Redirect" url="{C:0}/30" appendQueryString="false" />
</rule>
这些都失败了。我错过了什么?
这条规则将为您分叉:
<rule name="RestaurantDirect" stopProcessing="true">
<match url="Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/305$" />
<action type="Redirect" url="/Restaurant/Made-Main-Street/1990-Main-St-112-Sarasota,-FL-34236/30"/>
</rule>