Select a city

Buying a domain on Namecheap and pointing it to Heroku

This tutorial shows how to buy a domain on Namecheap and point a subdomain to a Heroku application. Bonus: configure an email redirection.

Share article
In this tutorial, we will walk through the necessary steps to buy a domain on Namecheap and configure the www subdomain to point to an existing Herokuapplication.


Buying the domain


Sign up to Namecheap with a username, email and password. Then search for an available domain. A domain is a name + a TLD, no need to type www (that would be a sub-domain).

I am buying the domain awesome-domain.fun. You can ignore all the upsell items under "Improve Your Site" and click on "Confirm Order":

You will have a few screens where you need to specify your identity (and your company's if you're buying it on behalf of your venture) until you get to the Payment page. You can choose between a credit card and Paypal. You are buying a domain for a specific amount of time (usually one year), which means that after a year you will have to pay again if you want to keep it. In my scenario, I am paying $0.88 now but if I want to renew it I will have to pay $19.88 next year.

You can now click on "Manage" to go to the Domain List admin section.

Pointing the domain to Heroku


💳 Before going further, you need a verified Heroku account which involves adding your credit card to Heroku under the Account > Billing tab. Don't worry, you won't be charged anything for adding a custom domain.

The goal is now to point the www subdomain to my previously created Heroku application. This is a 2-step process.

First connect to the Heroku dashboard, select the heroku application and go to the "Settings" tab. Scroll down until you reach the Domain and certificates section. Click on the purple "Add domain" button and type the domain name with its subdomainyou want to use. Here I am going to type www.awesome-domain.fun.

💡 Do not use a domain without a subdomain (called bare, naked, root or apex), as it brings limitations. Always use a subdomain.

You should now get the CNAME on Heroku, it should look like yourdomain.herokudns.com. Copy it, we will need it in Namecheap.

Go back to Namecheap Domain List, click on your domain to manage it. Then go to the Advanced DNS tab. You will find that the www subdomain (what Namecheap has under the column Host) is already assigned to a parking page. We need to edit this record. Click in the Value column to edit and paste what you copied in Heroku. Add a final dot . at the end. Then click on the little green tick icon to confirm.

That should be it! To check if this change has propagated to your local DNS server, you can use the dig command with:

dig CNAME www.yourdomain.tld
You can see in the screenshot above that www.awesome-domain.fun is pointing with a CNAME to www.awesome-domain.fun.herokudns.com. We are all good! You can open your favorite browser and go to http://yourdomain.tld to check the result 👏

Bonus - Redirect an email address


It may be useful to have an email like contact@yourdomain.tld. With Namecheap, you can set up an email redirection to go straight to your personal inbox.

Go to the Domain tab, and scroll down until you reach the Redirect Email section. Click on the Add Forwarder button, specify the forwarder (without the @yourdomain.tld) and your personal email. Confirm by clicking on the green tick icon.

That's it! Ask someone on your team to send an email to contact@yourdomain.tld:

You should receive it instantaneously 🍾.

What next?


If you want your website to use a https:// scheme, read on!

Want to know more about Le Wagon's 9-week bootcamp?
Download Syllabus
Keep reading
Graduate stories

It all started with wanting to make coffee…

A few weeks back I graduated from Le Wagon Montreal and after demo day I went to Corsica to spend some time with my dad who is unfortunately very sick. Once I got back, it was time to look for a job and reflect on my life over the last 3 months i.e. the bootcamp and changing careers.

Learn to code

How to migrate your Heroku Postgres database to Amazon RDS

If you are currently hosting an application on Heroku using the Heroku PostgreSQL add-on, you get 10,000 rows for free with the Hobby Dev plan. This limit may fill up quite fast depending on your app.

Graduate stories

From Hotel Manager to Developer/ Digital Marketeer in US Startup

As is so common when you’re in your early twenties, Guilherme “Gui” Andrade went through quite a bit of trial and error trying to find what made him ‘tick.' After studying architecture, then civil engineering, Gui decided to stick it out with hospitality management and went to Switzerland to complete his university degree.

Want to go further and learn to code in 9 weeks?

We are in 37 cities worldwide.