Frage

Google has indexed the home page of my website with https. But I need to redirect https to http only this page. I'm using Magento and today I have a rule that removes the htaccess www of my domain. Every rule I created to redirect the main page of https to http didn't work.
Anyone have a solution?
thank you

War es hilfreich?

Lösung

Try

#Redirect your Homepage from HTTPS to HTTP
RewriteCond %{HTTPS} on
RewriteRule ^$ http://%{HTTP_HOST} [L,R]

See http://www.activo.com/redirect-https-to-http-for-any-homepage/

Andere Tipps

Set this up in Magento first:

Oopen admin panel and visit System -> Configration -> Web panel and set:

  • Base URL (unsecured) as http://www.domain.com/magento/.

  • Base URL (secured) as https://www.domain.com/magento/.

then set:

  • Use Secure URLs in Frontend = Yes

  • Save your settings, clear your Magento cache

Finally in Magento's .htaccess add these lines just below RewriteBase line:

RewriteCond %{HTTPS} off
RewriteRule (?!^(index\.php/?|.*\.css|.*\.js|.*\.gif|.*\.jpe?g|.*\.png|.*\.txt|.*\.ico|)$)^ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]

RewriteCond %{HTTPS} on
RewriteRule ^(index\.php/?|.*\.css|.*\.js|.*\.gif|.*\.jpe?g|.*\.png|.*\.txt|.*\.ico|)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,NC]

Use this with 301 http request for google indexer.

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

If you use cludeflare then this redirect is not working

place try with below on you htaccess file and it cloudflare format

Http to Https redirection:

 RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
 RewriteRule ^(.*)$ https://www.domain.com/$1 [L]

See note:

When using Flexible SSL with CloudFlare, your origin server will always accept requests over HTTP (port 80). In order to properly redirect a user surfing securely over HTTPS, you should modify your rewrite rules to use the CF-Visitor HTTP header. The CF-Visitor header contains the following:

CF-Visitor: {"scheme":"http"}

or
CF-Visitor: {"scheme":"https"}

To redirect a user from HTTP to HTTPS, you can use the following:

RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
RewriteRule ^(.*)$ https://www.domain.com/$1 [L]

Similarly, to require all traffic go over HTTPS on CloudFlare, you can use the following:

RewriteCond %{HTTP:CF-Visitor} !'"scheme":"http"'
RewriteRule ^(.*)$ https://www.domain.com/$1 [L]
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top