简体   繁体   English

如何将HTTPS重定向到特定域的.htaccess中的HTTP?

[英]How can I redirect HTTPS to HTTP in .htaccess for specific domains?

We host a number of websites on our server. 我们在服务器上托管了许多网站。 Our main site, let's call www.domain.com. 我们的主要网站称为www.domain.com。

Anyway, we noticed that the other sites we host, etc, all point back to our main site (domain.com) when https:// is put in front of their domain. 无论如何,我们注意到当https://放在其域的前面时,我们托管的其他站点等都指向我们的主站点(domain.com)。 Part of the problem is that these are indexing in Google as well. 问题的一部分是这些也在Google中建立索引。

I've wondering how I can redirect all these in the htaccess - please help! 我想知道如何在htaccess中重定向所有这些内容-请帮助!

Add these rules to the htaccess file in your www.domain.com document root, preferably above any other routing rules that may be there: 将这些规则添加到www.domain.com文档根目录中的htaccess文件中,最好放在可能存在的任何其他路由规则之上:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R]

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

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