网站链接有两种状态:
1) http 这个容易被黑
2) http 和 https 混用,这个容易被 man-in-middle 攻击。
3) 全部用https,浏览成本增加,并影响用户体验
相关链接:
https://drupal.org/https-information
http://codekarate.com/blog/drupal-force-https-ssl
实践证明,在.htaccess文件加上下面两段,可以把所有链接转向成https的链接。
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www.yourdomainname.com
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^yourdomainname.com
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
或者这段:
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www.cinderellas.ca [OR]
RewriteCond %{HTTP_HOST} ^cinderellas.ca
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
下面这段可以将子目录及文件名包含“/gallery/”的改为“https://www.cinderellas.ca/”下的链接:
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^cinderellas.ca$
RewriteCond %{REQUEST_URI} (^.*)/gallery/(.*$) [NC]
RewriteRule (.*) https://www.cinderellas.ca/$1 [L,R=301]
但在Drupal下链接的子目录并不是实际的子目录,所以采用上面的代码,无效。