【发布时间】:2014-09-18 10:19:16
【问题描述】:
我有一个自定义域的青铜级帐户。我有一个 secure 子域配置为使用 SSL 证书,它工作正常。但是,我想在根域上强制使用 HTTP(即没有 SSL)。但是,当我浏览到 https://example.com 时,我得到了属于 example-myuser.rhcloud.com 的共享 SSL 证书。
如何为除 secure 之外的所有子域禁用 HTTPS?
我的别名设置为:
Alias Has Certificate? Certificate Added
--------------------- ---------------- -----------------
example.com no -
secure.example.com yes 2014-07-26
www.example.com no
如您所见,我将一个域(安全)配置为使用 SSL 证书。
我尝试使用以下 htaccess 规则,但它们不起作用。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# disable https on the root
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} ^example\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example\.com [NC]
RewriteRule (.*) http://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
【问题讨论】:
-
如您所见,我的 htaccess 规则已经按照该问题的答案进行设置。我认为带有 openshift 的配置有一些特定的东西。你会注意到我的安全子域 /already/ 尽管完全没有 htaccess 规则,但它仍然可以正常工作。
标签: apache .htaccess mod-rewrite ssl openshift