【发布时间】:2016-10-22 11:50:13
【问题描述】:
Stack Overflow上有很多类似的解决方案如htaccess http to https with www. Without redirecting sub domain。
然而,我需要的是:
- 主域 HTTPS + NON-WWW
- 所有子域的通配符 HTTP,而不是一个接一个地添加。
我正在运行一个 WordPress 多站点网站并且没有通配符 SSL。
我目前正在使用以下内容:
非WWW
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} www.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
非 WWW 和非 HTTPS 子域
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !=subdomain1.main.com
RewriteCond %{HTTP_HOST} !=subdomain2.main.com
RewriteCond %{HTTP_HOST} !=subdomain3.main.com
RewriteCond %{HTTP_HOST} !=subdomain4.main.com
SSL
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
【问题讨论】:
标签: wordpress apache .htaccess mod-rewrite ssl