简体   繁体   English

IIS 301重定向

[英]IIS 301 Redirect

We have migrated our web site to new web site (don't ask why?) 我们已将网站迁移到新网站(不要问为什么?)

In order to help us with the transition, we created 301 redirect, from the old web site to the new web site, in IIS. 为了帮助我们进行过渡,我们在IIS中创建了从旧网站到新网站的301重定向。 The redirect looks like http://www.newWebSiteApp.com $S$Q This handles all the sub directory as well as query string nicely. 重定向看起来像http://www.newWebSiteApp.com $ S $ Q这样可以很好地处理所有子目录和查询字符串。 we tested the redirect and works great, except for https requests. 我们测试了重定向,并且效果很好,除了https请求。

Both the new and old web sites have mixed protocol (some pages are http while other https). 新网站和旧网站都具有混合协议(某些页面是http,而其他页面是https)。 The redirect for https takes to http not https. https重定向到http而不是https。

We checked IIS setting, googled, and pulled our hair with no result. 我们检查了IIS设置,进行了谷歌搜索,没有结果。

So, Is it possible to redirect http -> http and https -> https on the same web site? 那么,是否可以在同一网站上重定向http-> http和https-> https?

You could use IIRF to do redirects. 您可以使用IIRF进行重定向。 It would be something like this: 就像这样:

RewriteCond   %{HTTPS} off
RewriteCond   %{HTTP_HOST}  ^www\.oldwebsite\.com$
RedirectRule  ^(.*)$        http://www.newwebsite.com$1 [R=301]

RewriteCond   %{HTTPS} on
RewriteCond   %{HTTP_HOST}  ^www\.oldwebsite\.com$
RedirectRule  ^(.*)$        https://www.newwebsite.com$1 [R=301]

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

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