Skip to main content
Connect a custom domain to your Netlify deployment to use your own domain name instead of the default Netlify subdomain.

Overview

The production site uses the domain services.dzaleka.com as configured in astro.config.mjs:13:
site: 'https://services.dzaleka.com'
This guide will help you set up any custom domain for your deployment.

Prerequisites

  • A registered domain name (from any domain registrar)
  • Access to your domain’s DNS settings
  • A deployed site on Netlify

Adding a Custom Domain

1
Add domain in Netlify
2
  • Log in to your Netlify dashboard
  • Select your site
  • Go to Site settingsDomain management
  • Click Add custom domain
  • Enter your domain name (e.g., services.dzaleka.com)
  • Click Verify
  • 3
    Choose domain type
    4
    You can add:
    5
    Apex domain (root domain):
    6
    dzaleka.com
    
    7
    Subdomain:
    8
    services.dzaleka.com
    
    9
    www subdomain:
    10
    www.dzaleka.com
    
    11
    Netlify recommends using a subdomain like www or a custom subdomain for better performance and flexibility.
    12
    Verify domain ownership
    13
    If you don’t own the domain on Netlify, you’ll need to verify ownership:
    14
  • Netlify will provide a verification code
  • Add a TXT record to your DNS with the code
  • Wait for verification (can take up to 24 hours)
  • Return to Netlify to complete setup
  • DNS Configuration

    Configure your DNS records based on your domain type. The easiest method is to use Netlify DNS:
    1
    Transfer DNS to Netlify
    2
  • In Domain management, click Set up Netlify DNS
  • Review the DNS records that will be created
  • Click Verify
  • Netlify will provide nameservers
  • 3
    Update nameservers
    4
  • Go to your domain registrar (GoDaddy, Namecheap, etc.)
  • Find DNS/Nameserver settings
  • Replace existing nameservers with Netlify’s nameservers:
    dns1.p0X.nsone.net
    dns2.p0X.nsone.net
    dns3.p0X.nsone.net
    dns4.p0X.nsone.net
    
    (Replace 0X with the actual values provided)
  • Save changes
  • 5
    Wait for propagation
    6
    DNS changes can take 24-48 hours to fully propagate globally.

    Option 2: External DNS

    If you prefer to keep DNS with your current provider:

    For Subdomain (e.g., services.dzaleka.com)

    Add a CNAME record:
    TypeNameValue
    CNAMEservicesyour-site.netlify.app
    Example for Cloudflare:
    Type: CNAME
    Name: services
    Content: dzaleka-online.netlify.app
    Proxy status: DNS only (gray cloud)
    TTL: Auto
    

    For Apex Domain (e.g., dzaleka.com)

    Add an A record pointing to Netlify’s load balancer:
    TypeNameValue
    A@75.2.60.5
    Netlify’s IP address may change. Using Netlify DNS or a subdomain is more reliable for apex domains.
    For better apex domain support, use an ALIAS or ANAME record if your DNS provider supports it:
    TypeNameValue
    ALIAS@your-site.netlify.app

    SSL/HTTPS Setup

    Netlify automatically provisions SSL certificates for custom domains.

    Automatic SSL Certificate

    1
    Certificate provisioning
    2
    After adding your domain:
    3
  • Netlify automatically requests an SSL certificate from Let’s Encrypt
  • This usually takes a few minutes
  • You’ll see the status in Domain managementHTTPS
  • 4
    Verify HTTPS
    5
    Once provisioned:
    6
  • Visit your domain with https://
  • Check for the padlock icon in your browser
  • Certificate is valid and automatically renews
  • 7
    Force HTTPS redirect
    8
    Ensure all HTTP traffic redirects to HTTPS:
    9
  • Go to Domain managementHTTPS
  • Enable Force HTTPS redirect
  • All http:// requests will redirect to https://
  • Troubleshooting SSL

    Certificate not provisioning:
    • Verify DNS records are correct
    • Wait 24-48 hours for DNS propagation
    • Check for CAA records blocking Let’s Encrypt
    Mixed content warnings:
    • Ensure all resources (images, scripts) use HTTPS
    • Update hardcoded http:// URLs to https://
    • Use protocol-relative URLs: //example.com/image.jpg

    Domain Redirects

    Configure domain redirects for common scenarios.

    www to non-www (or vice versa)

    Add both domains to Netlify, and Netlify will automatically redirect the secondary domain to the primary. Example: Redirect www.dzaleka.com to dzaleka.com:
    1. Add both dzaleka.com and www.dzaleka.com
    2. Set dzaleka.com as the primary domain
    3. Netlify automatically redirects www to non-www

    Custom redirects

    Add custom redirects in netlify.toml:
    netlify.toml
    # Redirect old domain to new domain
    [[redirects]]
      from = "https://old-domain.com/*"
      to = "https://services.dzaleka.com/:splat"
      status = 301
      force = true
    
    # Redirect specific path
    [[redirects]]
      from = "/old-path"
      to = "/new-path"
      status = 301
    

    DNS Verification Tools

    Use these tools to verify your DNS configuration:

    Check DNS records

    # Check A record
    dig dzaleka.com A
    
    # Check CNAME record
    dig services.dzaleka.com CNAME
    
    # Check nameservers
    dig dzaleka.com NS
    

    Online tools

    Email Configuration

    If you use email with your domain, preserve your email records:

    MX Records

    Preserve existing MX records when transferring DNS:
    Type: MX
    Name: @
    Priority: 10
    Value: mail.example.com
    

    SPF Records

    Maintain SPF records for email authentication:
    Type: TXT
    Name: @
    Value: v=spf1 include:_spf.google.com ~all
    

    DKIM Records

    Keep DKIM records if configured:
    Type: TXT
    Name: default._domainkey
    Value: v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3...
    

    Updating Site Configuration

    After setting up your domain, update your site configuration:
    1
    Update astro.config.mjs
    2
    Change the site URL to your custom domain:
    3
    export default defineConfig({
      site: 'https://your-custom-domain.com',
      // ... other config
    });
    
    4
    Update sitemap and robots.txt
    5
    Regenerate your sitemap with the new domain:
    6
    npm
    npm run generate-sitemap
    
    yarn
    yarn generate-sitemap
    
    pnpm
    pnpm generate-sitemap
    
    7
    Commit and deploy
    8
    Push changes to trigger a new deployment:
    9
    git add astro.config.mjs
    git commit -m "Update site URL to custom domain"
    git push
    

    Testing Your Domain

    Verify everything works correctly:
    1
    Test HTTPS
    2
    Visit your domain with HTTPS:
    3
    https://your-domain.com
    
    4
    Verify:
    5
  • Page loads correctly
  • SSL certificate is valid
  • No mixed content warnings
  • 6
    Test redirects
    7
    Test HTTP to HTTPS redirect:
    8
    http://your-domain.com
    
    9
    Should redirect to:
    10
    https://your-domain.com
    
    11
    Test subpaths
    12
    Verify all routes work:
    13
    https://your-domain.com/events
    https://your-domain.com/services
    https://your-domain.com/about
    
    14
    Test functions
    15
    Verify serverless functions work:
    16
    curl -X POST https://your-domain.com/.netlify/functions/submit-voice \
      -H "Content-Type: application/json" \
      -d '{"title": "Test"}'
    

    Common Issues

    DNS not propagating

    Symptoms: Domain not resolving or showing old site Solutions:
    • Wait 24-48 hours for full propagation
    • Clear your DNS cache: sudo dscacheutil -flushcache (macOS)
    • Try accessing from a different network
    • Use incognito/private browsing mode

    SSL certificate not provisioning

    Symptoms: “Not secure” warning or no HTTPS Solutions:
    • Verify DNS records point to Netlify
    • Wait for DNS propagation
    • Check for conflicting CAA records
    • Contact Netlify support if issue persists

    Domain showing Netlify default page

    Symptoms: Generic Netlify page instead of your site Solutions:
    • Verify domain is added in Netlify dashboard
    • Check that DNS records are correct
    • Ensure site is deployed successfully
    • Clear browser cache

    Next Steps