Question

I've succeeded in getting www.jamesdong.com and jamesdong.com to point to jamesdong.herokuapp.com. The problem is that once you get there, the address bar shows jamesdong.herokuapp.com rather than www.jamesdong.com or jamesdong.com.

Any idea how I can fix this? Feel free to try to see the problem in your own browser, site is live.

For reference:

heroku domains shows 3 domains:

jamesdong.com
www.jamesdong.com
jamesdong.herokuapp.com

I'm using TigerTech as my domain name provider, the settings are as follows:

  • DNS entry: www.jamesdong.com (I also tried using * in place of www as a wildcard, same problem resulted)
  • Type: CNAME
  • Data: jamesdong.herokuapp.com

And those are all the settings I can edit.

Thanks!

Was it helpful?

Solution 2

What ended up happening was that my DNS provider didn't allow ALIAS and CNAME changes so I put the below code in my application helper

 before_action :redirect_to_www if Rails.env == "production"

 def redirect_to_www
   unless /www\.jamesdong\.com/ =~ request.url
     uri = URI.parse(request.url)
     uri.host = "www.jamesdong.com"
     redirect_to uri.to_s
   end
 end

OTHER TIPS

Configure it like this

  ALIAS jamesdong.com => jamesdong.herokuapp.com
  CNAME www.jamesdong.com => jamesdong.herokuapp.com

It will be fixed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top