在某些页面直接http到https?

下面是我添加到我的.htaccess代码的一些代码,我如何添加某些页面被redirect到https? (如login.php&login.html)

另外,如果用户inputwww。 他们得到一个“不可信的连接”,因为SSL只有在没有www的情况下才有效。 我怎么能解决这个问题?

RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} /login.html RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

1)你总是可以使用apache RedirectMatch语句显式强制redirect:

 RedirectMatch ^/login.html$ https://myhostname/login.html RedirectMatch ^/logout.html$ https://myhostname/logout.html 

2)如果你明确的引导stream量到正确版本的主机名(即让他们习惯使用一种格式的url),SSL问题就会消失。 另一种select是使用SSL通配符证书,如果您想通过一个SSL实例来服务多个主机名。