【发布时间】:2014-02-09 00:07:52
【问题描述】:
我终于将我的网站从 Joomla 1.5 和 Virtuemart 1.1.9 更新到 Joomla 2.5 和 Virtuemart 2。我尝试为 Virtuemart 中的敏感区域启用 SSL,但它不起作用,我想使用 .htaccess 来访问改为进行重定向。
我已经尝试过这段代码,如果我的网站位于网站的根目录中,但它位于子文件夹中,即 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]
任何帮助都会很棒。
谢谢
【问题讨论】:
标签: apache .htaccess mod-rewrite redirect ssl