0

我正在使用一个 magento 网站,该网站上的所有页面都可以通过 http 和 https 访问,这可能会导致 google 出现重复内容问题。我需要正确的编码来在 htacces 中将所有 https 页面重定向到 http,但这些页面除外:

(不确定您是否需要单独的例外规则,或者它包含在以前的规则中)

  • /checkout/multishipping/地址/
  • /愿望清单/索引/索引/
  • /客户/帐户/登录/
  • /结帐/一页/成功

如果有人可以提供帮助,将不胜感激。谢谢。

4

1 回答 1

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]
于 2013-05-01T01:31:00.353 回答