hosais
hosais

Reputation: 164

Openshift "https" +non-www not works but "http" + non-www works

In my openshift Drupal hosting, the web is all under SSL

http: //domain.com -> https: //www.domain.com OK

http: //www.domain.com -> https ://www.domain.com OK

https ://domain.com <-- This webpage is not available

https ://www.domain.com OK

Why https ://domain.com is not working??

I start to think that https ://domain.com does not redirect to the host at all? but dont know why?

Note: My Configuration: 1) in DNS

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

2) in .htaccess. Two modifications:

#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 has no difference

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

Upvotes: 1

Views: 496

Answers (1)

user2879327
user2879327

Reputation:

Make sure that you have added the naked domain (example.com) and the www.example.com as aliases on your OpenShift application either in the web console, or through the rhc command line tools. That is the most common issue that we see with www.example.com working and example.com not working (or vice versa)

Upvotes: 1

Related Questions