Pillar GuideSeptember 8, 2026 11 min read

Redirect an Old Domain to a New Domain on WordPress

You're moving a WordPress site to a new domain and you need the old address to keep working. Someone types the old URL, follows an old bookmark, or clicks a link from years ago, and they should land on the same page on the new domain, not a dead end.

There are four real ways to make that happen: a WordPress plugin, an .htaccess rule if your host runs Apache, an nginx config if it doesn't, or a DNS-level redirect service. Which one fits depends on one thing more than any other: whether you're keeping the old hosting running or shutting it down.

The four ways to redirect a domain

Method Best when What you need
WordPress plugin Same host, only the domain name is changing WP admin access, no server access
.htaccess (Apache) Apache hosting that will keep running for a while File access to edit .htaccess
nginx config nginx hosting that will keep running for a while Root or sudo access, plus a config reload
DNS redirect service You want to cancel the old hosting entirely Access to change DNS at your registrar

Decide the redirect type first

A domain move is permanent. You are not bringing the old domain back as the live site. That means every redirect in this guide should be a 301, not a 302. A 301 tells Google the move is permanent and passes the old URL's ranking signal to the new one. A 302 tells Google the old URL might come back, so Google keeps the old URL as canonical and your new domain never takes over its rankings.

The only reason to use a 302 here is testing: set it up as a 302 first, confirm it lands where you expect, then switch it to a 301 once you're sure. For the full breakdown of when each status code applies, read 301 vs 302 redirect: the complete guide.

Preserve the path, not just the domain

A redirect that sends every visitor to your new homepage is not the same as a redirect that sends olddomain.com/blog/how-to-repot-a-fern to newdomain.com/blog/how-to-repot-a-fern. The first breaks every bookmark, every backlink, and every ranking you built on individual pages. The second carries all of it forward.

Google has said it may treat a redirect that always lands on the homepage as a soft 404 rather than a real move, which means the old page's ranking signal never transfers at all. Every method below can preserve the path. Set it up wrong, by hardcoding one destination URL instead of forwarding the incoming path, and you get the broken version instead.

Method 1: A WordPress redirect plugin

When this is the right call

You're keeping the same host and the same WordPress install, and only the domain name pointed at it is changing. This is common for a rebrand where nothing about your hosting changes, just what people type in the address bar.

Setting it up

Install a redirect plugin. Redirection is the most widely used free option and handles this case directly. Add a new redirect rule with the source pattern set to match everything (something like /(.*)$ with regex matching turned on) and the target set to your new domain with the captured path appended (https://newdomain.com/$1). One rule covers the whole site instead of redirecting page by page.

Where it falls apart

A plugin only runs once WordPress has loaded, which means PHP and your web server both have to be running and answering requests for the old domain. If you're also switching hosts, or you plan to cancel the old hosting account once the move is done, a plugin can't help you, because there will be nothing left to run it. That's the situation the DNS redirect service further down is built for.

Method 2: .htaccess on Apache

When this is the right call

Your current host runs Apache (most shared hosting does) and you're going to keep that hosting account active, at least for a while, so the old domain still has a server behind it.

The redirect rule

Add this near the top of your .htaccess file, above the block WordPress manages itself (marked # BEGIN WordPress and # END WordPress), so it runs before WordPress's own rewrite rules:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteRule ^(.*)$ https://newdomain.com/$1 [R=301,L,QSA]

This matches the domain with or without a www. prefix and forwards the full path and query string to the same location on the new domain. The query string carries across by default here, because the target URL has no parameters of its own. The QSA flag is what keeps it merged in if you ever add parameters to that target.

Where it falls apart

.htaccess only works while Apache is still serving that domain. The moment you cancel hosting or point DNS somewhere else, the file stops being read and the redirect stops existing. It's also easy to get the regex wrong and match more or less of the URL than you meant to. Test more than the homepage after you save the file.

Method 3: nginx

When this is the right call

Your current host runs nginx instead of Apache. This is common on VPS hosting and some managed WordPress platforms. You're keeping that server running for now, the same as the Apache case above.

The redirect rule

nginx doesn't read .htaccess files at all, so the rule has to go in the server block itself:

server {
    listen 80;
    listen 443 ssl;
    # keep the ssl_certificate and ssl_certificate_key lines already in this block
    server_name olddomain.com www.olddomain.com;
    return 301 https://newdomain.com$request_uri;
}

$request_uri includes both the path and the query string, so this one line preserves both. You are almost certainly editing the server block that already serves the old domain, so leave its certificate lines where they are. A listen 443 ssl block with no certificate will not load at all, and nginx -t tells you so before you reload. Reload nginx after saving the config for the change to take effect.

Where it falls apart

You need root or sudo access to edit nginx's config and reload the service, which many shared hosting plans don't give you. If you're on managed WordPress hosting, check whether your host has its own redirect setting in its control panel before trying to edit server config directly. Some don't allow direct access at all.

Method 4: A DNS-level redirect service

When this is the right call

You want the old domain to keep working, but you don't want to keep paying for or maintaining a server behind it. This is what a whole-domain move usually turns into: the WordPress site itself is moving too, and there's no reason to keep a second hosting account running just to serve redirects.

A DNS-level redirect service sits in front of the old domain instead of behind it. You point the domain's DNS at the service instead of at a web server, so the redirect fires before any request reaches PHP, Apache, or nginx, none of which need to exist for the old domain anymore.

RedirectBoss works this way: add the old domain as a host with the www subdomain included, then add the DNS records the dashboard shows you, which is an A record for the bare domain and a CNAME for www. Once DNS resolves, it provisions the SSL certificates automatically. Create one redirect rule with no path specified and a 301 status, and turn on both "Append original path" and "Preserve query parameters". Both of those switches start off, so set them before you save, and every URL on the old domain then forwards to the matching path on the new one. It's one option in this category, alongside plain domain forwarding at your registrar.

Registrar-level domain forwarding does a similar job for free in many cases, but check what it actually does before relying on it. The simplest versions forward every request to one fixed URL and drop the original path, which is exactly the problem the earlier section warned about.

Where it falls apart

The domain still needs an SSL certificate, or visitors on https:// hit a certificate warning before the redirect ever runs (the browser checks the certificate before it reads the redirect). And if the old domain's registration lapses because nobody's watching it once the old host is gone, the redirect stops existing along with the domain.

Update WordPress itself, not just the redirect

The redirect handles traffic hitting the old domain. It does nothing about WordPress's own references to that domain, which stay baked into the new site if you don't change them.

Site URL settings

Go to Settings, then General, and update both the WordPress Address (URL) and Site Address (URL) fields to the new domain. If you can't reach wp-admin because the URLs are already wrong, set WP_HOME and WP_SITEURL directly in wp-config.php instead.

Search and replace the database

WordPress stores full URLs, including the domain, inside post content, widget settings, and serialized data throughout the database. Changing the two settings above doesn't touch any of that. Run a proper search-and-replace across the database (WP-CLI's wp search-replace, or a plugin such as Better Search Replace, both handle serialized data correctly, which a plain find-and-replace would corrupt) to swap every stored reference from the old domain to the new one.

Your sitemap

Once the site URL is updated, your sitemap (from Yoast, Rank Math, or WordPress's own built-in sitemap) starts listing the new domain automatically. Confirm it did before moving on to Search Console.

Tell Google the site moved

Search Console change of address

If both the old and new domains are verified properties in Google Search Console, use the Change of Address tool from the old property's settings. It tells Google directly that the move is intentional and permanent, on top of what the 301 redirects already signal.

Submit the new sitemap

Add the new domain's sitemap to Search Console under the new property. Leave the old domain's Search Console property in place. Google keeps using it to show how the old URLs are being recrawled and redirected, which is useful for confirming the move is going the way you expect.

What actually breaks when this goes wrong

  • A 302 instead of a 301. Google keeps the old domain as canonical, so the new one never takes over its rankings.
  • A redirect chain. Old domain to www version to new domain to www version, each an extra hop. Chains add latency and are where a step quietly gets missed. Collapse it to one hop wherever you can.
  • Mixed content after the move. If the new site still loads any resource, an image or a script, from http:// on the old domain, browsers may block it or flag the page as insecure, even though the redirect itself works fine.
  • Killing the old domain's DNS or registration too early. Bookmarks, old backlinks, and search results that haven't been recrawled yet all depend on the old domain still resolving. Losing it early turns a working redirect into a dead end.

Verify the redirect actually works

Don't assume it's working because the homepage redirects correctly. Check a few different paths, not just /.

curl -I -L https://olddomain.com/some-post/

-I returns headers only, -L follows the redirect. Look for a 301 status on the first response and a Location header pointing at the matching path on the new domain, followed by a 200 once it lands. Test both http:// and https://, and both with and without www, since each is technically a separate redirect and it's easy to configure three out of four.

Test in an incognito or private window, or clear your cache first. Browsers cache 301 redirects aggressively, so checking with a browser that already cached the old page or an earlier version of the redirect can give you a false result.

Google Search Console's URL Inspection tool gives you the same information without the command line: paste an old URL and it shows whether Google sees the redirect and where it points.

The free Redirect Checker does it in a browser too, and it lists every hop in the chain rather than only the first one, which is how you catch a redirect that lands on the right page after two unnecessary stops.

How long to keep the redirects up

Keep them running for at least a year. That's Google's own guidance for site moves, and it accounts for how long it takes search results, cached links, and third-party sites to catch up to the change. If the old domain had meaningful backlinks or organic traffic, keeping the redirect up longer, even indefinitely if the domain is cheap to renew, protects that traffic for as long as those old links keep sending people there.

Whichever method you use, the two things that decide whether this works are the same: a 301 status code, and a path that carries over instead of dumping everyone on the homepage. Get those right and it doesn't matter which of the four methods you used to do it.

Frequently asked questions

Should I use a 301 or a 302 redirect for a domain move?
Use a 301. The move is permanent, so a 301 tells Google to transfer your ranking signal to the new domain. A 302 tells Google the old URL might come back, so Google keeps the old URL as canonical and the new domain never takes over its rankings.
Do I need to keep the old WordPress hosting running?
Only if you redirect with a WordPress plugin, .htaccess, or an nginx config, since all three need the old server to still be running and answering requests. A DNS-level redirect service is the one method that keeps working after you cancel the old hosting, because it points the domain's DNS somewhere other than that server.
How long should I keep the redirects live?
At least a year. That's Google's own guidance for site moves, and it gives search results, cached links, and other sites time to catch up to the change. Keeping it up longer costs little if the domain is cheap to renew.
Will redirecting to a new domain hurt my search rankings?
A correct 301 redirect that preserves the path passes your existing ranking signal to the new domain instead of losing it. What actually hurts rankings is getting the redirect wrong, most often by using a 302 or by sending every URL to the homepage instead of the matching page.
Can I just use my registrar's free domain forwarding?
Only if it lets you set a real 301 and preserves the path instead of sending everyone to one fixed URL. Check both before relying on it. Many free forwarding tools do neither.
From the makers of this guide

Redirects shouldn't be the hard part.

Add a domain, point your DNS, and start redirecting. RedirectBoss handles SSL, DNS verification, and gives you one dashboard for every rule.

Try RedirectBoss