Setup Domain or Subdomain in Vercel

Setting Up a Domain or Subdomain in Vercel

This guide will walk you through the process of setting up a custom domain or subdomain in Vercel.

Prerequisites

Steps to Add a Domain or Subdomain

1. Adding a Domain to Vercel

  1. Go to your Vercel dashboard.
  2. Open the project you want to connect to a domain.
  3. In the project settings, navigate to the Domains tab.
  4. Click Add and enter the domain you want to add (e.g., example.com).
  5. If Vercel is your domain registrar, the domain will automatically be verified.
  6. If you’re using an external domain provider, you’ll need to set up DNS records. Instructions for common providers are given below.

2. Adding a Subdomain to Vercel

  1. Open the project in your Vercel dashboard.
  2. Go to the Domains tab.
  3. Click Add, then enter the subdomain (e.g., sub.example.com).
  4. If using an external DNS provider, you’ll need to create a CNAME record pointing to cname.vercel-dns.com.
  5. After setting the DNS record, click Verify in Vercel to ensure the subdomain is correctly set up.

3. Configuring DNS Settings

Depending on where your domain is registered, you may need to configure DNS settings manually. Here’s how to do it for common providers:

A. If You Registered Your Domain with Vercel

No further action is required. Your domain should automatically point to Vercel.

B. If You Use an External DNS Provider (e.g., GoDaddy, Namecheap)

  1. Log in to your domain registrar’s dashboard (e.g., GoDaddy, Namecheap).
  2. Navigate to the DNS management section.
  3. Add the following records for a root domain (e.g., example.com):
    • Type: A
    • Name: @
    • Value: 76.76.21.21 (Vercel’s IP)
  4. Add a CNAME record for a subdomain (e.g., sub.example.com):
    • Type: CNAME
    • Name: sub
    • Value: cname.vercel-dns.com
  5. Save the DNS changes.

4. Wait for DNS Propagation

Once you’ve updated your DNS records, it may take some time (up to 48 hours) for the changes to propagate. You can check the status in the Vercel dashboard under Domains.

5. SSL Configuration

Vercel automatically provisions SSL certificates for your domain, so there’s no need to manually configure SSL. Once your domain is verified, Vercel will automatically apply SSL for secure HTTPS access.

6. Testing the Domain/Subdomain

After setting up the domain or subdomain:

  1. Navigate to the URL in your browser (e.g., https://example.com or https://sub.example.com).
  2. Ensure the site loads properly with a secure connection (HTTPS).

Conclusion

Your domain or subdomain should now be properly set up in Vercel. If you encounter any issues, check the Vercel documentation or reach out to their support for assistance.