我目前有3个域在我的cPanel帐户与HostGator。我试图强制主域使用HTTPS,但所有其他域都使用HTTP。当我将以下内容添加到主目录.htaccess文件中时,它也会强制它位于所有子目录上。
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}有没有办法不让它在其他域名上这样做呢?
发布于 2014-12-29 16:55:51
您只需要另一个RewriteCond并检查HTTP_HOST,这样就不会将RewriteRule应用到不需要有https的域:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^no-https-needed.example.com$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}https://stackoverflow.com/questions/27692706
复制相似问题