我有一个带有自定义域的青铜级帐户。我有一个配置为使用 SSL 证书的 secure
子域,它工作正常。但是,我想在根域上强制使用 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>
最佳答案
您很接近,但是 SERVER_PORT
是继续 OpenShift (see here) 的错误方式。
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# disable https on the root
RewriteCond %{HTTP:X-Forwarded-Proto} https
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]
关于apache - 在带有自定义域的 OpenShift 中从 HTTPS 重定向到 HTTP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24974735/