簡體   English   中英

IIS 7.5 URL重寫將舊URL重定向到新URL的重定向規則

[英]IIS 7.5 URL rewrite redirect rule for old URL to new URL

我正在嘗試映射此舊的Webform URL

http://www.mysite.com/Listing.aspx?mlsnum=T5017910

到這個新的MVC URL:

http://www.mysite.com/listing?id=T5017910

我莫名其妙地不能使它工作。 我的規則如下:

<rule name="My Listing Redirect Rule" stopProcessing="true">
    <match url="^Listing.aspx?mlsnum=([0-9a-z]+)" ignoreCase="true" />
    <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Redirect" url="listing?id={R:1}" redirectType="Permanent" />
</rule>

任何幫助表示贊賞。

您的<match url=...>需要轉義? 字符試試看:

<match url="Listing.aspx\?mlsnum=([0-9a-z]+)" ignoreCase="true"/>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM