Reputation: 699
I've followed all the instructions on https://devcenter.heroku.com/articles/custom-domains to get my custom domain set up, and it still isn't working.
On Heroku, I have the following domains:
myapp.herokuapp.com
example.com
www.example.com
And on Namecheap, I have the following settings:
HOST NAME | IP ADDRESS/URL | RECORD TYPE
@ http://example.com
URL Redirect
www myapp.herokuapp.com
. CNAME(Alias)
When I run: "host www.example.com
" in my terminal, I expect to get "www.example.com
is an alias for myapp.herokuapp.com
". Instead, I get:
"www.example.com
is an alias for myapp.heroku.com
"
I can't figure out why it is pointing to myapp.heroku.com
, because I have only specified myapp.herokuapps.com
.
Does anybody know why this is happening?
Upvotes: 46
Views: 20471
Reputation: 5610
Update note: Heroku and Namecheap change their interfaces every so often. This answer may have outdated screenshots, but it will be updated over time. See these updates below.
I've just done this myself so I thought I'd chime in as the answer doesn't illustrate how to get both www.example.org
and example.org
working. Heroku also changed its admin interface a bit.
<name>.herokuapp.com
in both url-boxes (@ and www).(PS: If they're not there, click the "Add new record" and add them there.)
example.org
and click Save.www.example.org
and click Save.That's it, You're done! Now when you enter example.org
or www.example.org
in your browser, both will show your Heroku project.
In this example, http://lakka.herokuapp.com would be accessible (after DNSes update) also on http://lakkatracker.com and http://www.lakkatracker.com.
(If you want to redirect traffic from www.example.org
to example.org
, which is a good practise, you can use the record type "URL (Redirect)" for the www host name)
It can take some time before your DNSs recognize the changes. You can try using a proxy for testing, like Anonymouse, if your changes aren't reflected immediately.
Upvotes: 53
Reputation: 61
I couldn't get both www.example.com
and example.com
to work, so one of the workarounds I found was to set the CNAME and @ to www., and then on the Domain tab, set "Redirect Doman" from example.com
to www.example.com
.
Upvotes: 0
Reputation: 1
I linked a namecheap domain to my Heroku app today and it is now a bit different, so here is what I did.
www.example.com
. The 'www' is important. Copy the generated xxx.herokudns.com
link.http://www.example.com
Upvotes: 0
Reputation: 24775
If you want all the traffic to point to http://example.com
then do this:
and set both example.com
and www.example.com
in Heroku settings.
Then test everything by using http://anonymouse.org
Upvotes: 5
Reputation: 11
Depending on your application, it may be a result of not using an SSL certificate. If you are trying to use an SNI SSL on the free dyno it is not going to work. In my case, I upgraded to hobby dyno and it immediately worked via the ACM.
Upvotes: 1
Reputation: 2019
Set up a namecheap config that looks like this:
And a heroku config that looks like this:
Upvotes: 3
Reputation: 951
Namecheap updated its interface. New screenshots to supplement other good answers:
Upvotes: 18
Reputation: 10797
1) Go To Namecheap, and go to the domain you want to manage.
2) On the left sidebar, click "All Record Hosts", NOT any of the other jazz other tutorials tell you. No DNS pointing changes are necessary. It's easier to use alias.
3) Once you do, you'll see a line starting with "www" as a CNAME (Alias) option. Fill this in as your heroku app's domain name example.herokuapp.com
That's it for namecheap.
4) Then at heroku settings, under "domains", enter your purchased domain name you wish to be displayed.
That's it! It's as easy as letting heroku and namecheap know about both domain aliases.
Credits to this blog: http://blog.romansanchez.me/2013/06/08/point-namecheap-domain-to-heroku/
Update:
Apparently, heroku will only allow sites with www.
prepended. To have a true root domain without www.
will take some extra ninja hacking.
Upvotes: 37
Reputation: 647
Here are 2 possibilities,
You could try registering a different (free) domain with an entity like .tk to see if this is specific to NameCheap.
Upvotes: 0