Type something to search...
How to connect a custom domain to your WordPress site?

How to connect a custom domain to your WordPress site?

To connect a custom domain to your WordPress site, you point the domain at your hosting by either changing its nameservers to your host's nameservers or adding DNS records (an A record for the root domain and a CNAME for www) at your domain registrar. Then you add the domain in your hosting control panel, update the WordPress Address and Site Address under Settings > General if your site used a temporary URL, and enable SSL so the site loads over HTTPS. DNS changes can take anywhere from a few minutes to 48 hours to spread across the internet.

Your domain name is your address on the web, and connecting it properly is one of the first real milestones of launching a site. This guide explains how domains and DNS fit together, walks through both connection methods, covers WordPress.com and self-hosted WordPress, and shows how to update URLs safely and troubleshoot the most common problems.

How Domains, DNS, and Hosting Fit Together

It helps to understand three separate pieces:

  • Domain registrar: The company where you bought your domain, such as Namecheap, GoDaddy, Porkbun, or Cloudflare Registrar. It records that you own the name.
  • DNS (Domain Name System): The internet's address book. DNS records tell browsers which server's IP address to contact when someone types your domain.
  • Web host: The server where your WordPress files and database live.

Sometimes all three are the same company. For example, many hosts include a free domain and manage DNS for you. Other times, your domain is registered in one place, DNS is managed somewhere else (like Cloudflare), and your site is hosted elsewhere again. Connecting a domain simply means making DNS point to your host.

Before You Start

Gather this information:

  1. Your registrar login: You'll need access to the domain's DNS or nameserver settings.

  2. Your host's nameservers or IP address: Find these in your hosting dashboard or welcome email. Nameservers look like ns1.examplehost.com, and an IP address looks like 203.0.113.10.

  3. Existing email records: If you already use email on this domain, such as Google Workspace or Microsoft 365, note your MX and TXT records so you don't break email.

  4. A backup: If your WordPress site is already built on a temporary address, back it up before changing URLs.

Method 1: Change Your Domain's Nameservers

Changing nameservers hands over full DNS management to your host. It's the simplest approach and is usually what hosts recommend.

  1. Find your host's nameservers: Look in your hosting dashboard, often under a section called Domains or DNS. Most hosts provide two to four nameservers.

  2. Log in to your registrar: Open the domain's management page.

  3. Find the nameserver settings: Look for Nameservers, DNS, or Manage DNS. Choose the option for Custom nameservers.

  4. Enter your host's nameservers: Replace the existing entries with your host's nameservers, one per field.

  5. Save your changes: The registrar may show a warning that DNS changes can take time. That's normal.

  6. Add the domain in your hosting account: In your hosting control panel, add the domain to your account or assign it to your WordPress site. In cPanel, this happens under Domains. Many managed WordPress hosts have an Add Domain button on the site's settings page.

Important: When you switch nameservers, any DNS records at your old DNS provider stop working. If you use email on this domain, recreate your MX, SPF, DKIM, and other records in your host's DNS zone before or immediately after switching.

Method 2: Point DNS Records to Your Host

If you want to keep DNS at your registrar or with a provider like Cloudflare, add records that point to your host instead of changing nameservers. This keeps your existing email and other records intact.

  1. Get your host's IP address: Find the server's IPv4 address (and IPv6, if provided) in your hosting dashboard.

  2. Open your DNS zone: At your registrar or DNS provider, open the DNS records editor for your domain.

  3. Add or edit the A record: Create an A record for the root domain (often shown as @) pointing to your host's IP.

  4. Add a CNAME for www: Create a CNAME record for www pointing to your root domain or to the hostname your host gives you.

  5. Remove conflicting records: Delete any old A or CNAME records for @ and www that point elsewhere, including registrar parking pages.

  6. Add the domain in your hosting account: As in Method 1, tell your host that the domain belongs to your site.

Here's what a typical setup looks like in zone file format:

; Root domain points to the web server
example.com.        3600    IN    A        203.0.113.10

; www points to the root domain
www.example.com.    3600    IN    CNAME    example.com.

; Optional IPv6 address
example.com.        3600    IN    AAAA     2001:db8::10

Your provider's editor will usually just ask for a Type, Name (or Host), Value (or Points to), and TTL. Use the values your host gives you; the IPs above are documentation examples.

Some hosts, especially platforms built on load balancers, ask you to use a CNAME for www pointing to their hostname and an A record or an ALIAS/ANAME record for the root domain. Follow your host's instructions exactly.

Lower the TTL First

TTL (time to live) controls how long DNS resolvers cache a record. If you're moving an existing domain, lower the TTL on your current records to 300 seconds a day before the change. That way, when you update the records, the change propagates faster.

Connecting a Domain to WordPress.com

If your site is hosted on WordPress.com rather than a self-hosted WordPress.org installation, the process is handled from your WordPress.com dashboard:

  1. Open domain settings: In your WordPress.com dashboard, go to Upgrades > Domains (the exact label can vary as the dashboard evolves).

  2. Add a domain you own: Choose the option to use a domain you already own, and enter it.

  3. Choose connect or transfer: Connect keeps the domain at your registrar and points it to WordPress.com; Transfer moves the registration to WordPress.com.

  4. Follow the instructions: WordPress.com will show you which nameservers or DNS records to set at your registrar.

Custom domains on WordPress.com require a paid plan.

Update Your WordPress URLs

If you built your site on a temporary URL, such as a host-provided subdomain or an IP address, you'll need to update WordPress to use your new domain.

Option 1: Settings > General

  1. Log in to your dashboard: Use the temporary URL if the new domain isn't live yet.

  2. Open General Settings: Go to Settings > General.

  3. Update both URLs: Change WordPress Address (URL) and Site Address (URL) to your new domain, including https:// if SSL is ready.

  4. Save your changes: WordPress will log you out. Log back in using the new domain.

Option 2: wp-config.php

If you can't access the dashboard, define the URLs in wp-config.php above /* That's all, stop editing! */:

define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );

These constants override the database values. You can leave them in place or remove them after updating the settings in the dashboard.

Replace Old URLs in Your Content

Changing the site URLs doesn't update links and images already inside your posts and pages. Those still point to the temporary address. Use WP-CLI to replace them safely, including in serialized data:

wp search-replace 'https://temp.examplehost.com' 'https://example.com' --skip-columns=guid --dry-run

If the dry run looks correct, run it again without --dry-run. If you don't have WP-CLI, the Better Search Replace plugin does the same thing from the dashboard. Back up your database before running either one.

Enable SSL for Your Domain

Every site should load over HTTPS. Once DNS points to your host:

  1. Issue a certificate: Most hosts provide free SSL certificates through Let's Encrypt. Look for an SSL or Security section in your hosting panel and enable it for your domain, including www.

  2. Wait for validation: The certificate can only be issued once your domain resolves to the host, so this may need to wait for DNS propagation.

  3. Force HTTPS: Make sure your WordPress URLs start with https://, and redirect HTTP traffic to HTTPS. Many hosts provide a toggle for this.

Choose www or Non-www

Decide whether your main address is example.com or www.example.com. Either is fine, but pick one and redirect the other to it. Your choice should match the URLs in Settings > General. WordPress automatically redirects to the version set there for most requests, and many hosts add a server-level redirect too.

If you need to enforce it yourself on Apache, add this to .htaccess above the WordPress block to redirect www to the root domain:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]
</IfModule>

On Nginx, a separate server block handles it:

server {
    listen 443 ssl;
    server_name www.example.com;
    ssl_certificate     /etc/ssl/certs/example.com.pem;
    ssl_certificate_key /etc/ssl/private/example.com.key;
    return 301 https://example.com$request_uri;
}

Check DNS Propagation

After making changes, you can check whether your domain points to the right place:

  • Online tools: Websites like whatsmydns.net show DNS results from locations around the world.
  • Command line: On macOS, Linux, or Windows, use nslookup or dig:
dig +short example.com A
dig +short www.example.com CNAME
nslookup example.com

If the results show your host's IP address, you're connected. Different locations may update at different speeds, so some visitors might see the old site for a while.

Troubleshooting Common Domain Problems

The domain shows a registrar parking page: An old A record or URL forwarding rule is still active at your registrar. Remove it and make sure your records point to your host.

The domain shows your host's default page: DNS is working, but the domain isn't assigned to your WordPress site in your hosting panel. Add the domain to the correct site or document root.

"Your connection is not private" errors: The SSL certificate hasn't been issued for this domain yet, or it doesn't include www. Reissue the certificate once DNS resolves.

Redirect loops: Often caused by mismatched URLs in Settings > General, or by Cloudflare's SSL mode being set to Flexible while your host also forces HTTPS. Set Cloudflare's SSL/TLS mode to Full (strict) when your host has a valid certificate.

Email stopped working: You switched nameservers without recreating your MX and related records. Add them to your new DNS zone.

Images still load from the old URL: Run a search-replace on your database, then clear your caching plugin and CDN.

Can't log in after changing URLs: Your URLs may contain a typo. Fix them with the WP_HOME and WP_SITEURL constants in wp-config.php or with WP-CLI's wp option update home and wp option update siteurl commands.

After Connecting Your Domain

Once everything works, finish with a few tasks:

  • Re-save permalinks: Go to Settings > Permalinks and click Save Changes.
  • Update Google Search Console: Add the new domain as a property and submit your sitemap. If you moved from another domain, use the Change of Address tool.
  • Update external links: Social profiles, email signatures, and business listings should use the new domain.
  • Set up redirects from any old domain: If the site previously lived on another domain, redirect it with 301 redirects so you keep traffic and search rankings.
  • Renew your domain automatically: Turn on auto-renew at your registrar so your site never goes offline because of an expired domain.

FAQ: Connecting a Custom Domain to WordPress

DNS changes often work within minutes to a few hours, but full propagation can take up to 48 hours, depending on the TTL of your records and DNS caching around the world.

Changing nameservers is simpler and lets your host manage everything. Using A and CNAME records is better if you want to keep DNS with your registrar or Cloudflare, or if you already have email records you don't want to move.

No. You can keep your domain registered anywhere and simply point it to your host with nameservers or DNS records. Transferring is optional and mostly about convenience.

It can if you change nameservers without recreating your email records. Copy your MX, SPF, DKIM, and DMARC records to the new DNS provider before switching.

Your SSL certificate hasn't been issued for the new domain yet. Enable SSL in your hosting panel once DNS points to your host, and make sure your WordPress URLs use https.

No. WordPress.com requires a paid plan to use a custom domain. Self-hosted WordPress.org sites can use any domain you own with any host.

  • A record: Points the root domain to your host's IPv4 address.
  • CNAME record: Points www to your root domain or host's hostname.
  • AAAA record: Optional, for your host's IPv6 address.

Conclusion

Connecting a custom domain to WordPress comes down to pointing your domain at your host, either by switching nameservers or by adding A and CNAME records, and then telling both your host and WordPress about the new address. Once DNS propagates, enable SSL, pick your preferred www or non-www version, and update any old URLs in your content.

Take care with email records and TTLs if you're changing an existing domain, and check propagation before assuming something is broken. With your domain connected and running on HTTPS, your WordPress site has a professional, permanent home on the web.

Tags :
Share :

Related Posts

What are the best WordPress security plugins?

What are the best WordPress security plugins?

The best WordPress security plugins for most sites are Wordfence, Sucuri Security, Solid Security, MalCare, All-In-One Security (AIOS), Patchstack, a

Dive Deeper
What is the difference between posts and pages in WordPress?

What is the difference between posts and pages in WordPress?

The main difference between posts and pages in WordPress is that posts are timely, dated entries that appear in your blog feed, archives, and RSS fee

Dive Deeper
How much does it cost to build a WordPress website?

How much does it cost to build a WordPress website?

Building a WordPress website can cost anywhere from roughly the price of a domain and a year of budget hosting, if you do it yourself with free tools

Dive Deeper