How to use naked GoDaddy domain with OpenShift hosting? [closed]

隐身守侯 提交于 2019-11-27 19:47:03

问题


Desired Behaviour

I have a GoDaddy domain name and am using OpenShift for hosting.

I would like the following to be true:

a) user enters www.mysitename.com > user sees mysitename.com

b) user enters www.mysitename.com/about.html > user sees mysitename.com/about.html

c) user enters mysitename.com or mysitename.com/about.html and they also see that url.

d) to summarise, the www prefix is never displayed anywhere on the site.

Constraints

OpenShift hosting does not have a static IP, so it is not possible to adjust the A record at GoDaddy.

The format for the OpenShift app is http://appname-username.rhcloud.com.

You can set up a cname at GoDaddy with the following:

www > appname-username.rhcloud.com

This means the site is accessible at www.mydomain.com but not at mydomain.com.

Suggested Solutions

There are several posts on the topic that suggest the following but for several reasons are not adequate solutions:

  • use a subdomain ie blog.mydomain.com

  • use wwwizer

  • use forwarding and masking (causes the url to stay the same when navigating relative links)

Question

Can anyone think of another solution that satisfies the desired behaviour stated above?

Or do I need to change to a registrar that allows "naked cname records"?

Related Posts

https://stackoverflow.com/questions/18431034/godaddy-domain-pointing-to-openshift-hosting
Naked domain with Openshift
How do I add an alias for a naked domain with OpenShift?

Edit

This blog posts sums up the scenario:

http://blog.cloudflare.com/zone-apex-naked-domain-root-domain-cname-supp

Could I sign up for CloudFlare to resolve the issue?

I haven't used it before and don't know how it works.


回答1:


Solution

01) Sign up to cloudflare
02) Set these cname rules:

mydomain.com > appname-username.rhcloud.com (this will utilise 'cname flattening')

www > mydomain.com

03) Set page rules:

http://www.mydomain.com/* > http://mydomain.com/$1

04) Set alias in OpenShift to mydomain.com

05) Make sure GoDaddy DNS record doesn't have any conflicting cname or A record set up.

06) Let it simmer overnight and all of the original desired behaviour should be working.




回答2:


Here is what worked for me.

Domain name : example.com
openshift app: myapp-mydomain.rhcloud.com

--on godaddy
      Domains>All Domains>select your domain example.com>click DNS ZONE FILE tab
      1. delete www CNAME
      2. create new Record with 
         Record Type CNAME > HOST: www > POINT TO: myapp-mydomain.rhcloud.com
      3. click Finish 

      Click Settings tab
      1. Forwarding > click Manage
         Forward to:www.example.com > Redirect: 301 (Permanent) > Type: Forward only
      2. click ADD

--on Openshift
      1. select Application tab > select application myapp-mydomain.rhcloud.com        
         > click change
      2. enter Domain name www.example.com

That's it. Wait for 10-15 min and see the magic.




回答3:


To get your domain (with 'www' and without), to successfully point to your OpenShift alias, without 'masking' or 'forwarding' see this tutorial I wrote:

  • How to get a custom domain and naked domains work for your OpenShift application

It works with CNAME Flattening.




回答4:


@Azghanvi: I faced the same problem. Make sure you add "www.example.com" as your alias in openshift and not "example.com". Seems like Godaddy does not support "example.com" by default.



来源:https://stackoverflow.com/questions/23169529/how-to-use-naked-godaddy-domain-with-openshift-hosting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!