2014-02-27 18 views
1

我的要求是所有https網址在http上打開並檢出,我的帳戶頁面始終在https上打開。 我嘗試這個代碼,但沒有解決https到http更改網址通過magento網站中的.htaccess,除了結帳或我的帳戶頁面

RewriteEngine on 
# From https to http 
RewriteCond %{HTTPS} on 
RewriteCond %{REQUEST_URI} ^/ 
#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/cart/ [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

你的第一個規則在大部分地區評論。 – anubhava

+0

其不工作.. – Swapan

回答

1

此代碼解決了這個問題

Options +FollowSymLinks 
    RewriteEngine on 


RewriteEngine on 
RewriteCond %{SERVER_PORT} ^443$ 
RewriteRule ^(shop|blog|stockists|inthepress|contacts|review|home) http://www.example.com%{REQUEST_URI} [R=301,L] 

RewriteCond %{HTTPS} on 
RewriteRule ^$ http://%{HTTP_HOST} [L,R] 
0

,你可以使用如下並且這是在我的網站的一個爲我工作。

############################################ 
## enable rewrites 

Options +FollowSymLinks 
RewriteEngine on 

RewriteCond %{SERVER_PORT} 80 
    RewriteRule ^index.php/onepagecheckout/?$ https://%{HTTP_HOST}/index.php/onepagecheckout 
[R,L] 

    # RewriteRule ^index.php/yourpageurl/?$ https://%{HTTP_HOST}/index.php/yourpageurl 
[R,L] 

希望你能理解,它可能對你有用。

+0

感謝您的回覆。我的要求是我嘗試點擊一個網址https://www.example.com/其更改爲http://www.example.com – Swapan

+0

但我認爲這應該是你的工作。 – liyakat

相關問題