简体   繁体   English

IIS中的301重定向

[英]301 redirect in IIS

So we have a client whereby we are hosting their site but with 2 different domains mapped (we have bindings for both domains) to the same site in IIS. 因此,我们有一个客户端,通过该客户端托管他们的站点,但将2个不同的域映射到IIS中的同一站点(两个域都有绑定)。 this is primarily because when they started with us they could only purchase the domain they didn't ultimately want to use going forwards. 这主要是因为当他们开始与我们合作时,他们只能购买最终不希望使用的域名。

For example the domains are www.some-thing.com and www.something.com. 例如,域名是www.some-thing.com和www.something.com。

They have asked if I can put a 301 permanent redirect in on the URL with the hyphen so then users should always go to the non hyphen version of the site. 他们询问我是否可以使用连字符在URL中添加301永久重定向,因此用户应始终转到网站的非连字符版本。

I have tried URL rewrite rules and using the HTTP redirect in IIS however the site is then in a re-direct loop and I think this is down to the fact I have both domains bound to the site in IIS. 我尝试了URL重写规则,并在IIS中使用HTTP重定向,但是该站点处于重定向循环中,我认为这是因为我将两个域都绑定到了IIS中的站点。

Help !! 救命 !!

Thanks in advance 提前致谢

Try this URL Rewrite .Here is the Source 试试这个URL重写。这里是

<rule name="fromadd Host Name" stopProcessing="false">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTP_HOST}"  pattern="^anitkb\.com$" />
      </conditions>
      <action type="Redirect" url="To address" redirectType="Permanent" />
    </rule>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM