← Web design from scratch

Connect your own domain

Your website has a structure, a design and several pages. Now you’ll learn how a domain gives visitors a professional address for your project.

Level · Beginner Time · 25–35 min Path · Web design

01

What is a domain?

A domain is a name people enter in their browsers to reach a website.

Here’s an example:

www.example.com

A recognisable name is easier to remember than a technical address.

Think of the domain as the address visitors use to reach your site.

02

Domains and hosting

Each plays a different role in getting your website online.

01

Domain — the address visitors use to find your website.

02

Hosting — the service that stores and serves your website files.

If you publish with GitHub Pages, GitHub can serve those files for you.

03

What is DNS?

DNS stands for Domain Name System.

DNS records help direct traffic for a domain to the appropriate service.

Here’s a simple way to picture it:

example.com
↓
DNS
↓
server or hosting service
Connecting a domain usually involves updating some DNS records with the provider that manages it.

04

The root domain and www

These addresses are related and may use different DNS records.

example.com
www.example.com

The first is called the root domain or apex domain.

www is a subdomain.

05

Add your domain in GitHub Pages

If you use GitHub Pages, add the custom domain in the repository settings before directing DNS traffic to GitHub.

01

Open your project repository.

02

Go to Settings.

03

Open Pages.

04

Find Custom domain.

05

Enter the domain you want to use and save it.

Once you configure the DNS records, GitHub can check them.

06

Configure the DNS records

Open the DNS settings at the provider that manages your domain.

The records you need depend on whether you’re connecting the root domain or a subdomain such as www.

Check the platform’s current documentation before adding DNS records. IP addresses and other values in older tutorials may have changed.

07

What is a CNAME record?

A CNAME record lets one name, such as a subdomain, point to another domain name.

For a GitHub Pages site, you might point:

www

to an address like:

username.github.io

The exact destination depends on the account or organisation hosting the site.

08

DNS changes can take time

After you update a record, the change may take time to appear everywhere.

This is commonly called DNS propagation.

If a change hasn’t taken effect yet, double-check the records and give the update time to propagate before editing them again.

09

Enable HTTPS

HTTPS encrypts the connection between the browser and the website.

After GitHub Pages checks the domain and HTTPS is available, look for Enforce HTTPS in Pages settings.

Your site should use an address such as:

https://example.com

rather than the unencrypted HTTP address:

http://example.com

10

Check the versions of your address

When setup is complete, test the addresses that apply to your configuration.

https://example.com
https://www.example.com

Make sure each one takes visitors to the primary address you set up.

11

Common mistakes

01

Misspelling the domain name.

02

Using the wrong DNS record.

03

Leaving conflicting or duplicate records in place.

04

Testing before DNS changes have propagated.

05

Forgetting to test HTTPS.

12

Check what each record does before changing it

Your DNS panel may contain records for other services.

For example, some records may be used for your domain’s email.

Identify what an existing record does before removing it. Keep the records that your other services still need.

What you’ve learned

  • What a domain is.
  • The difference between a domain and hosting.
  • What DNS does.
  • The difference between the root domain and www.
  • Where to set up a domain in GitHub Pages.
  • What a CNAME record does.
  • Why DNS changes can take time.
  • Why HTTPS matters.
  • Why to test each version of your domain.
  • Why to review DNS records before removing them.

Plan your domain connection

Walk through the setup so you know what to do when you’re ready to connect a domain.

  1. Identify where your website is hosted.
  2. Identify where you’d manage your domain.
  3. Find your provider’s DNS settings.
  4. Find Settings → Pages in GitHub.
  5. Locate the Custom domain field.
  6. Read the current GitHub Pages documentation on custom domains.
  7. Check how to enable HTTPS.
You can complete this course without buying a domain. The goal is to understand the steps so you can use them when you’re ready.

PREVIOUS LESSON

← 09 · Create and connect multiple pages