我有几个网站,共享一个htaccess文件(Drupal multisite),并想将其中几个重定向到网站的https版本。我看到一个域名的this solution:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^specific\.com [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}我想修改它以适用于多个域,但不确定是否可以执行以下操作,或者是否需要重写这些行:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^specific\.com [NC]
RewriteCond %{HTTP_HOST} ^another\.com [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}我不想尝试它,以防我炸掉几个活跃的网站。
发布于 2016-12-13 01:42:38
有两个选项:
RewriteCond %{HTTPS}关闭RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} L,R=301,NE
[OR]子句的目标特定子域:RewriteCond %{HTTPS}关闭RewriteCond %{HTTP_HOST} ^specific.com NC,或RewriteCond %{HTTP_HOST} ^another.com NC RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} L,R=301,NE
https://stackoverflow.com/questions/41106422
复制相似问题