2013-05-01 103 views
0

我使用的是magento網站,通過http和https訪問網站上的所有網頁,這可能會導致Google重複出現內容問題。我需要適當的編碼在htacces重定向所有https網頁這些網頁的例外爲http:將https重定向到.htacces中,但有一些例外情況

(不知道你需要爲這些還是我一個單獨的例外規則T公司的包括以前的)

  • /結算/ multishipping /地址/
  • /心願/指數/指數/
  • /客戶/帳號/登錄/
  • /結算/ onepage /成功

非常感謝,如果任何人都可以提供幫助。謝謝。

回答

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] 
+0

我試了一下,該網站上的所有常規頁面,如果你以https嘗試將適當重定向到HTTP,但是當我試圖訪問任何需要被頁面保證例如願望清單頁面,我看到頁面更改爲https,然後重定向到主頁。這可能是因爲那些需要安全的頁面在我加入此代碼之前已被重定向到https。或者在htacces編碼中可能存在某種衝突?我可以上傳.htacces文件,如果你想看到它。 – 2013-05-02 00:54:43