【发布时间】:2016-11-28 12:02:30
【问题描述】:
我有两个网站
- yourdomain.com
- reseller.yourdomain.com
现在我想通过 apache htaccess 重定向强制两个域使用 https。除此之外,主域应始终使用 www 而不是非 www。但是子域 reseller.yourdomain.com 当然不应该使用 www。
重定向应该是什么样子?我已经尝试了很多类似的东西
RewriteEngine on
RewriteCond %{HTTPS} !^on
RewriteCond %{HTTP_HOST} !^reseller\.yourdomain\.com [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
这不是 100% 有效,主域正确重定向到 www 和 ssl,subomdain 的 ssl 重定向仅适用于 reseller.yourdomain.com,不适用于 reseller.yourdomain.com/single-page 等子站点.
谢谢!
【问题讨论】:
-
读到这里,我可能会得到你的答案:stackoverflow.com/questions/20894947/…
-
不起作用 :-( 子域 reseller.yourdomain.de 重定向到主域。
标签: apache .htaccess redirect ssl