我希望.htaccess不在主页链接上添加SSL
但网站上的其他所有链接
因此只有主页不安全。什么是最好的.htaccess配置?
由于
答案 0 :(得分:1)
使用RewriteRule
来匹配{em>在<{1}}之外存在的任何,如果匹配,则重写为SSL:
/
答案 1 :(得分:0)
通过httpd.conf
启用mod_rewrite和.htaccess,然后将此代码放在.htaccess
目录下的DOCUMENT_ROOT
中:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^.+$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} =on
RewriteRule ^$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]