How can I redirect HTTPS to HTTP in .htaccess for

2019-09-18 01:36发布

问题:

We host a number of websites on our server. Our main site, let's call 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. Part of the problem is that these are indexing in Google as well.

I've wondering how I can redirect all these in the htaccess - please help!

回答1:

Add these rules to the htaccess file in your www.domain.com document root, preferably above any other routing rules that may be there:

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