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 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.
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.