本文介绍了Web配置-将具有域的特定URL重定向到另一个URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将testdomain.com/diamonds/silver重定向到testdomain.com/diamonds.

I would like to redirect testdomain.com/diamonds/silver to testdomain.com/diamonds.

我需要指定域,因为该网站具有多个附加域.

I need to have the domain specified because the website has several domains attached to it.

这就是我现在所拥有的,但它似乎无能为力.

This is what i have now, but it does not seem to do anything.

<rule name="testredirect" stopProcessing="true">
        <match url=".*" />
         <conditions logicalGrouping="MatchAny">
           <add input="{HTTP_HOST}" pattern="^testdomain.com/diamonds/silver" />
         </conditions>
         <action type="Redirect" url="/diamonds" redirectType="Permanent" />
 </rule>

我也尝试过这样做,但是那也不起作用.

I have also tried this, but that did not work either.

<rule name="testredirect" stopProcessing="true">
    <match url="^testdomain.com/diamonds/silver" ignoreCase="true" />
    <action type="Redirect" url="/diamonds" redirectType="Permanent"/>
</rule>

有什么建议吗?

我知道了.在下面回答!

推荐答案

最后.

这有效:

<rule name="redirect diamonds" stopProcessing="true">
            <match url="^diamonds/diamondrings" ignoreCase="true" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="^(www.)?mywebshop.azurewebsites.net" />
            </conditions>
            <action type="Redirect" url="/diamondrings" redirectType="Permanent" />
        </rule>

这篇关于Web配置-将具有域的特定URL重定向到另一个URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 12:41