HTTPS重定向到http在.htacces有一些例外重定向、HTTPS、htacces、http

2023-09-02 10:05:13 作者:蛰伏半世情

我使用的是Magento的网站,网站上的所有页面都通过HTTP和HTTPS访问,这可能会导致与谷歌的重复内容的问题。我需要适当的编码重定向在htacces所有https网页访问http除了这些页面的:

I'm using a magento website and all pages on the site are accessible through http and https and that might be causing duplicate content issues with google. I need the proper coding for redirecting in htacces all the https pages to http with the exception of these pages:

https://www.example.com/checkout/onepage/ /客户/帐号/ /结账/ multishipping /登录/ /心愿/ /index.php/admin/dashboard/index/key / https://www.example.com/checkout/onepage/ /customer/account/ /checkout/multishipping/login/ /wishlist/ /index.php/admin/dashboard/index/key/

(不知道你是否需要这些一个单独的例外规则,或者它包含在previous的)

(Not sure if you need a seperate exception rule for these or it's included in the previous ones)

/结账/ multishipping /地址/ /心愿/指数/指数/ /客户/帐号/登录/ /结账/ onepage /成功

将不胜AP preciate如果任何人都可以提供帮助。谢谢你。

Would greatly appreciate if anyone can help. Thanks.

推荐答案

尝试:

RewriteEngine On

# From https to http
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/checkout/onepage/
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/onepage/ [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]