【问题标题】:How redirect all web-site to other domain?如何将所有网站重定向到其他域?
【发布时间】:2013-10-26 09:07:36
【问题描述】:

我有一个测试域,它在 goolge 中被索引,但它是错误的。

现在我需要创建从具有所有参数的所有页面到其他域的 301 重定向。

我可以创建动作过滤器并在其上创建重定向,但这对我来说也是错误的。

我知道它可以在 webconfig 中实现什么。但我不明白怎么做。

请你帮帮我。

我尝试使用:

<rewrite>
<rules>
<rule name="Redirect to main subdomain from test domain">
    <match url="^.*$" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^(www\.)uh261477\.ukrdomen\.com$" ignoreCase="true" />
     </conditions>
     <action type="Rewrite" url="http://kitesurfing-base.com{R:0}"  redirectType="Permanent" />
</rule>
</rules>
</rewrite>

但它不起作用

【问题讨论】:

    标签: regex .htaccess mod-rewrite redirect web-config


    【解决方案1】:

    您可以将此规则放在您的 web.config 中以进行此重定向:

    <rule name="Redirect to main subdomain from test domain">
        <match url="^.*$" />
        <conditions>
            <add input="{HTTP_HOST}" pattern="^(www\.)testdomain\.com$" ignoreCase="true" />
         </conditions>
         <action type="Rewrite" url="http://otherdomain.com{R:0}"  redirectType="Permanent" />
    </rule>
    

    【讨论】:

    • @Mediator:Rule 似乎很简单,可以使用,但我不是基于 Windows 的开发人员,所以无法猜测为什么它不会。
    猜你喜欢
    • 2017-03-22
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    • 2017-04-30
    • 2018-08-05
    • 2019-02-16
    • 1970-01-01
    • 2022-07-07
    相关资源
    最近更新 更多