Dreamhost, Google App Engine and the naked domain forwarding fun

What are we trying to achieve:

We want a domain (both naked and with the www prefix) to point to our Google App Engine hosted project. For purposes of our demonstration, we will use the domain of my quick ‘n’ dirty project that I put together to play with GAE.

This doesn’t sound too difficult in theory. The gotcha is that google doesn’t support naked domains (i.e. the non prefixed version of the domain name) for some reason. The google documentation suggests that you add a CNAME record for your www prefixed domain to ghs.google.com and then forward or redirect your naked domain to your www prefixed domain.

I’m going to assume you have your project in GAE all set up and that you have followed google’s instructions on getting the domain name through to google apps, insane though it is that you have to do that instead of just having it all in the app engine admin side, but hey….I’ll jump through hoops for a free hosted nosql implementation.

Ok, on to the Dreamhost side – problem is, choosing the “fully hosted” option at Dreamhost, I couldn’t add a CNAME record for my domain because there is a non-editable CNAME already added by Dreamhost. Choose the “Google Hosted” option, and the www.example.com works, but I could not forward the naked domain to the www sub-domain because the domain was no longer hosted at Dreamhost and I couldn’t insert a redirect anywhere….. Arrrg!

This is what I did:

  • Enable the “DNS only” in Dreamhost.
  • Add a custom CNAME record for www.example.com.
  • Enable “Fully hosted” in Dreamhost with the “Remove WWW:” option.
  • Weyhey….now www.example.com goes to the google app engine hosted project, and example.com points to a directory at Dreamhost.
  • Last step – set up a .htaccess file in said directory to redirect the naked domain to www.example.com.

And it works!