Openshift“https”+非www无效,但“http”+非www有效

时间:2014-12-18 12:10:17

标签: ssl https dns openshift

在我的openshift Drupal托管中,网络全部都在SSL下

http://domain.com - > https://www.domain.com确定

http://www.domain.com - > https://www.domain.com确定

https://domain.com< - 此网页不可用

https://www.domain.com确定

为什么https://domain.com无法正常工作?

我开始认为https://domain.com根本没有重定向到主机?但不知道为什么?

注意:我的配置: 1)在DNS中

@-> https: //www.domain.com    URL redirect 301
www->openshift domain      CNAME

2)在.htaccess中。两个修改:

#redirect all http to https
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

#rewrite openshift domain to domain.com
RewriteCond %{HTTP_HOST} ^domain.rhcloud.com$
RewriteRule (.*)$ https://www.domain.com/$1 [R=301,L] 

3)打击,启用或禁用没有区别

# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following:
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

1 个答案:

答案 0 :(得分:1)

确保您已将裸域(example.com)和www.example.com作为别名添加到OpenShift应用程序中,无论是在Web控制台中,还是通过rhc命令行工具。这是我们在www.example.com工作和example.com无法正常工作时看到的最常见问题(反之亦然)