2014-01-19 31 views
0

我只是最終將我的網站從Joomla 1.5和Virtuemart 1.1.9更新到Joomla 2.5和Virtuemart 2.我曾嘗試在Virtuemart中爲敏感區域啓用SSL,但它不是工作,我想用.htaccess來做重定向。.htaccess將http重定向到敏感區域的https

我曾嘗試這個代碼,如果我的網站是位於該網站的根目錄,將工作,但它是一個子文件夾,即www.uniqbuy.com/electronics

我怎樣才能得到這個代碼不在重定向到https時從URL中取出電子郵件?

# Force SSL on checkout login account and admin pages 
RewriteCond %{HTTPS} off 
RewriteCond %{REQUEST_URI} checkout|login|my-account|administrator|webshop 
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$ [NC] 
RewriteRule ^(.*)$ https://%2/$1 [R=301,L,QSA] 

# Remove SSL on other pages 
RewriteCond %{HTTPS} on 
RewriteCond %{REQUEST_URI} !checkout|login|my-account|administrator|webshop 
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$ [NC] 
RewriteRule ^(.*)$ http://www.%2/$1 [R=301,L,QSA] 

# Force www for non https 
RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L,QSA] 

任何幫助將是偉大的。

謝謝

回答

0

你的第二條規則似乎是使用錯誤的正則表達式。試試這個代碼:

# Force SSL on checkout login account and admin pages 
RewriteCond %{HTTPS} off 
RewriteCond %{REQUEST_URI} (checkout|login|my-account|administrator|webshop) 
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)$ [NC] 
RewriteRule ^(.*)$ https://%2/$1 [R=301,L] 

# Remove SSL on other pages 
RewriteCond %{HTTPS} on 
RewriteCond %{REQUEST_URI} !(checkout|login|my-account|administrator|webshop) 
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$ [NC] 
RewriteRule ^(.*)$ http://www.%2/$1 [R=301,L] 

# Force www for non https 
RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L,QSA] 
+0

Thanks for this。我設法讓它在我的子文件夾上進行安裝,但它並沒有將內容保存在http和https之間的內存切換中。然後找到了很好的Yireo SSL重定向,並解決了所有問題。 –

相關問題