0

I want to redirect https to http for almost all pages, except for the checkout and account.

It is not the way to redirect https to http, I need an exception for some pages, that needs to run over https.

How do I define that inside my htaccess?

I tried this, but that does not work:

Options +FollowSymLinks
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/
RewriteCond %{REQUEST_URI} !^/customer/account/
RewriteCond %{REQUEST_URI} !^/checkout/
RewriteCond %{REQUEST_URI} !^/wishlist/
RewriteCond %{REQUEST_URI} !^/ebizautoresponder/
RewriteCond %{REQUEST_URI} !^/index.php/admin/dashboard/index/key/
#RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

I use this Magento settings (I removed the entire URL):

enter image description here

JGeer
  • 1,768
  • 1
  • 31
  • 75

1 Answers1

0

Try this rule as your very first rule:

RewriteEngine On

RewriteCond %{HTTPS} on
RewriteCond %{THE_REQUEST} !\s/+(customer/account|checkout|wishlist|ebizautoresponder|index\.php/admin/dashboard/index/key) [NC]
RewriteRule !\.(?:jpe?g|gif|bmp|png|tiff|css|js)$ http://%{HTTP_HOST}%{REQUEST_URI} [NE,NC,L,R=301]
anubhava
  • 761,203
  • 64
  • 569
  • 643
  • Thanks! I tried your code, that does redirect correct to the checkout on https. But it only breaks down other code, like css and other content. How is that possible? – JGeer Oct 27 '15 at 17:27
  • Thanks, almost good! Except the font for icons is not displaying well. Font Awesome for example. – JGeer Oct 27 '15 at 17:37
  • What is the full GET request for `icons`? Does it end with `.ico`? – anubhava Oct 27 '15 at 17:39
  • Yes, but there a more things that are broken. So is there not an other or better way to fix this? Because it runs by default great on https, but all other pages should be redirect to http. – JGeer Oct 27 '15 at 18:25
  • Unless until you provide concrete info `more things that are broken` won't be of be much help. You haven't even provided your full .htaccess in question. Also you need to provide URLs that don't work. – anubhava Oct 27 '15 at 18:32