ASP.net中的永久重定向

时间:2012-12-10 07:03:50

标签: asp.net url-redirection

我想重定向到网址

http://www.abc.com/preview.asp?type=content&id=237#logo

http://www.abc.com/preview.aspx#logo

关于重写规则的任何想法,如:

<rule name="Home Document" stopProcessing="true">
                <match url="^visiting.aspx$"  />
                <conditions>
                    <add input="{QUERY_STRING}" pattern="^utm_source=invite%2B&amp;utm_medium=Email%2B&amp;utm_campaign=exhibitor$" />
                </conditions>
                <action type="Redirect" url="http://www.abc.com/visiting.aspx" appendQueryString="false"/>
            </rule>

由于

1 个答案:

答案 0 :(得分:0)

您需要添加redirectType="Permanent"以生成301状态代码:

<rule name="Home Document" stopProcessing="true">
            <match url="^visiting.aspx$"  />
            <conditions>
                <add input="{QUERY_STRING}" pattern="^utm_source=invite%2B&amp;utm_medium=Email%2B&amp;utm_campaign=exhibitor$" />
            </conditions>
            <action type="Redirect" url="http://www.abc.com/visiting.aspx" appendQueryString="false" redirectType="Permanent"/>
 </rule>