2

I have a domain that's been deployed via Heroku, and is up and running fine with the www. But if I go to the domain without the www, it does not render correctly. I tried adding both domains on Heroku, with www and without www, but unfortunately it still does not work.

Also, I tried following step two on here but continued to get an error: An unexpected error occurred. If this issue continues, contact support.

How can I add a naked domain to GoDaddy to forward to my web deployed on Heroku like my domain with www?

First Description GoDaddy (Only manually added the Heroku URL to CNAME www and Domain Forward to Heroku URL).

Second Description DNS Target set to Heroku URL and Domain on Heroku (Have one row for www and other without www).

Ly Maneug
  • 21
  • 1
  • 3
  • Can you post an example of what you DNS settings look like?? – closetnoc Sep 20 '16 at 23:03
  • @closetnoc Sure thing, on GoDaddy or Heroku? – Ly Maneug Sep 21 '16 at 00:41
  • I am not sure how your domain is set up, so if it is set-up on GoDaddy, that is a starting place. For the record, I have no clue about Heroku. I did go to the site to see what web server was being used and somehow, I did not see it. If it is Apache, I may be able to help there too. At least, I can see what you can see and perhaps something will jump out at me. If I have not clue, then perhaps someone will. Cheers!! – closetnoc Sep 21 '16 at 00:44
  • @closetnoc Definitely. So stackexchange currently isn't allowing me to post images so I will just post the links here. Please refer back to the original post for descriptions. First description: http://i.stack.imgur.com/INXIO.png http://i.stack.imgur.com/y7OS7.png and Second description: http://i.stack.imgur.com/KMeEb.png http://i.stack.imgur.com/ol71G.png Images are cut off just to hide vital info. – Ly Maneug Sep 21 '16 at 01:17
  • Okay. The DNS looks okay at first blush. The rest I have no idea about. Have you call their tech support? – closetnoc Sep 21 '16 at 01:51
  • Have you considered a redirect of example.com to www.example.com. I know it might not be the best but it will work. – norcal johnny Sep 22 '16 at 05:59
  • @norcaljohnny don't think I have yet. sorry but how so? – Ly Maneug Sep 22 '16 at 06:11
  • @LyManeug see posted answer. – norcal johnny Sep 22 '16 at 06:51

1 Answers1

1

There are two ways. Either use URL forwarding or you can use a redirect in your .htaccess file. Try URL forwarding first.

URL Forwarding

To get this to work, go to the GoDaddy domain information and set forwarding to www.example.com.

.htaccess method

RewriteEngine on 
#if host ==domain.com
RewriteCond %{HTTP_HOST} ^domain\.com$
#and uri==/mypage
RewriteCond %{THE_REQUEST} /mypage
#redirect the request to http://app-heroku.com
RewriteRule ^(.*) http://app-heroku.com [P]

This will force people who do not use the non-www to the www.

Depending on your hosting (cpanel/plesk) Here are the steps. godaddy.com/help/redirect-urls-with-your-hosting-account-512‌​0

norcal johnny
  • 2,400
  • 9
  • 11
  • Appreciate the answer but are you referring to the root folder in GoDaddy/Heroku or my project itself? Sorry, just haven't heard anything like this before. Is this some type of a hack/work around? – Ly Maneug Sep 22 '16 at 07:04
  • Try the URL forwarding in Godaddy first. Then if that does not work I will help you with the htaccess. – norcal johnny Sep 22 '16 at 23:11
  • Sorry but could you guide me on how to do the forwarding? I believe I already have one set up for www Heroku on Godaddy – Ly Maneug Sep 23 '16 at 02:32
  • "I believe I already have one set up for www " that may also be why the non-www does not load right. But depending on your hosting (cpanel/plesk) Here is the steps. https://www.godaddy.com/help/redirect-urls-with-your-hosting-account-5120 – norcal johnny Sep 23 '16 at 02:51