4

All my pages are indexed with https: URL in Google because in the past my my secure base URL and unsecure base URL both were https://www.example.com

Now my secure base URL is https://www.example.com an unsecure base URL is http://www.example.com

Such that checkout and customer pages open with https://www.example.com and all other pages open with http://www.example.com

Issue:

As my all page are indexed as https in Google, I want to redirect https non checkout and non customer URLs to http

I tried with this .htaccess code, without success:

RewriteEngine on
# From https to http
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/
#RewriteCond %{REQUEST_URI} !^/customer/account/
#RewriteCond %{REQUEST_URI} !^/checkout/multishipping/login/
#RewriteCond %{REQUEST_URI} !^/wishlist/
#RewriteCond %{REQUEST_URI} !^/index.php/admin/dashboard/index/key/
#RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

# From http to https
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/checkout/cart/ [OR]
RewriteCond %{REQUEST_URI} ^/customer/account/ [OR]
RewriteCond %{REQUEST_URI} ^/checkout/multishipping/login/ [OR]
RewriteCond %{REQUEST_URI} ^/wishlist/ [OR]
RewriteCond %{REQUEST_URI} ^/index.php/admin/dashboard/index/key/
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
2

This code solved this problem

Options +FollowSymLinks
    RewriteEngine on


RewriteEngine on
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(shop|blog|stockists|inthepress|contacts|review|home) http://www.example.com%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} on
RewriteRule ^$ http://%{HTTP_HOST} [L,R]
  • Can you please add your full example. I mean to say with the URI on which you want http and on which you do not want. Thank you very much. – Abbas Feb 6 '17 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.