简体   繁体   中英

htaccess redirect https to http except specific pages

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):

在此处输入图片说明

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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