https://www.domain.com 确定 http://www.domain-6ren">
gpt4 book ai didi

ssl - Openshift "https"+non-www 不工作但 "http"+ non-www 工作

转载 作者:太空宇宙 更新时间:2023-11-03 13:26:34 28 4
gpt4 key购买 nike

在我的 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) blow, enabled or disabled 没有区别

# 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]

最佳答案

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

关于ssl - Openshift "https"+non-www 不工作但 "http"+ non-www 工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27546308/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com