How to use a custom domain
h
dotcomboom (80)

In case you've worked with repl.it before, you may have noticed that you are given a decently long subdomain for your project, like the following:
my-little-blog--dotcomboom.repl.co

You may have wanted to change that into a shorter, more memorable domain name, like this: mylittleblog.cf

Let's see how.

Getting your domain

This section will cover registering a domain name with Freenom. If you already have a domain, skip this part.

A word on Freenom

You don't own it

Freenom hands a selection of domain names out like free candy. If you've heard of dot.tk, it's these guys. In this tutorial I'll walk you through them, but I'd also like to point out that by registering a domain name with Freenom, you are still not entitled to it. It's perfectly valid and legal for them to all of a sudden deactivate your domain and use it to make money with ads, without notification. This is just a fair warning, some people have had domains from Freenom for a long time without any issues, but anything can happen. In short, nothing could be actually free. You are borrowing Freenom's domains for your purposes, and don't own them like you would from another registrar.

HTTPS

If you use Freenom, you won't be able to use HTTPS. You need to use "http://" before your domain instead. You will still be able to use your repl.co domain name if you need to use HTTPS, so make note of that. As https://repl.it/@turbio pointed out, HTTPS does work with a Freenom domain! You just need to wait a little bit of time for it to get set up. As for "mission critical" applications, like, say, Uptime Robot or something like that, you will probably want to use your repl.co domain.

Registering the domain

You will want to make or log into a Freenom account first. Then, you will be brought to the Client Area. Once you're signed in, you will find "Register a New Domain" under the Services menu.

This will bring you to Freenom's domain search. Type in the name you want. In this example, I searched for "mylittleblog". It will give you a list of what domains they have available.

Choose the one you want, then scroll down to the bottom and choose "Checkout". Don't touch the section in the middle, we'll cover that later. Choose the period you'll be using the domain, which is from 3 months to 12 months. (If memory serves, when you're going close to the due date, you are offered the opportunity to renew.)

Check the box to agree to the Terms and Conditions (reading them is a good idea too) and complete the order. Then, go back to your client area.

Attaching to repl.it

Repl.it setup

Go to your repl and click on the pencil icon next to the address in the preview pane.

Type in your domain name and if the domain is registered correctly, it will prompt you to add a CNAME record to your domain:

Copy where the record should point to, then go to your client area at your registrar (in my case, Freenom).

Registrar setup

From My Domains, go to the management page for the domain you chose. From Management Tools, choose Nameservers. Make sure it is checked to use default nameservers.

Then, find the area where you can add records; for Freenom, it is "Manage Freenom DNS". In the Name textbox, enter your domain name, nothing more, nothing less. Change the type to CNAME. Then, set the target to what repl.it asked you. Then, choose Save Changes.

Finish

Now go back to your repl. Repl.it now should have noticed that your domain is set up correctly and now lets you click on the Link button.

You're done! Your domain should now be attached to your repl.

You are viewing a single comment. View All
Scoder12 (396)

I was having the issue of where its saying "CNAME records should have a name set! " but I just used www for the name and it worked as long as I put www.mydomain.tld in repl instead of just mydomain.tld

EDIT: I would honestly recommend using the free service cloudflare as DNS as it has a bunch of cool features in addition to supporting @ signs in their DNS. All you have to do is uenter the custom nameservers they provide in freenom.

ayuubOmer (4)

@Scoder12 Thanks that really helped me!

AgastyaSandhuja (91)

@Scoder12 If you want your domain to be the cname, just put an @ sign as the name. If you want a subdomain, put the subdomain name. It helps too.

Scoder12 (396)

@AgastyaSandhuja thats exactly the error I get when I put that lol. Freenom dns is so bad just use cloudflare

AgastyaSandhuja (91)

@Scoder12 worked for me :/ maybe freenom is different.

Scoder12 (396)

@AgastyaSandhuja maybe they changed it since then but many people including me have gotten that same error when following the tutorial (judging by the other comments mentioning it and the amount of upvotes on my comments). Thanks for trying to help =)

LuukWalstra (0)

@Scoder12
In Freenom you can't use the @ anymore as CNAME name. To use the website with a non-www domain, you have to use an A-record. To use it you have to get the IP Address of your website. Follow the next steps to do it.

  1. Open the command prompt (Windows) and type 'nslookup '[PUT HERE THE CNAME LINK FROM REPL.IT].
  2. You will see the next thing:

    Under 'Non-authoritative answer:' You will see an IP Address.
  3. Make a new A-Record in the DNS managemant. Leave the name blank and set the target to the IP Address what you see in the Command Prompt. This is what you should have:
  4. Save it and link the domain WITHOUT www.
Scoder12 (396)

@LuukWalstra that is a bad solution as repl.it's IP could change at any time. It is better to use cloudflare for this.

LuukWalstra (0)

@Scoder12 They bought that ip address via Google. All codes from every website is in the Google Cloud so if they change there ip, everybody will lose there repls. So they won't change it.

Scoder12 (396)

@LuukWalstra technically true but I'm pretty sure repl.it checks for a CNAME and won't link unless the record is a CNAME, not an A. Using cloudflare takes like 2 extra minutes and gives you automatic TTL, which I'd say is worth it.