我正在使用magento网站,网站上的所有网页都可以通过http和https访问,这可能会导致谷歌出现重复的内容问题。我需要正确的编码,将htacces中的所有https页面重定向到http,但这些页面除外:
(不确定您是否需要针对这些规则的单独例外规则,或者它是否包含在之前的规则中)
如果有人能提供帮助,我将不胜感激。感谢。
答案 0 :(得分:0)
尝试:
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]