How to Change WordPress Domain Without Losing Traffic
Changing your WordPress site’s domain name is a significant move that can feel risky, especially if you’re worried about losing the search rankings and traffic you’ve worked hard to build. This guide walks you through the entire process safely, ensuring that your existing visitors and search engine rankings are preserved through proper redirects and careful planning. You’ll learn the exact steps to take before, during, and after the switch, so you can move to your new domain with confidence.
What You’ll Need
- Access to your WordPress admin dashboard (wp-admin).
- FTP or file manager access to your web hosting account.
- Access to your domain registrar (where you bought the domain) and your hosting control panel (like cPanel).
- A backup plugin or manual backup of your site files and database.
- Your new domain name already registered and pointing to your hosting (if you’re using the same host, you may need to add it as an addon domain or park it).
Step-by-Step
- Back up everything. Before touching anything, create a full backup of your WordPress files (via FTP or a backup plugin) and your database (via phpMyAdmin or a plugin). Store the backup in a safe place outside your server.
- Install a redirect plugin (or prepare .htaccess). The easiest way to handle redirects is to use a plugin like “Redirection” or “Really Simple SSL” (if you’re also moving to HTTPS). Alternatively, you can edit your .htaccess file manually, but a plugin is more user-friendly and less error-prone.
- Update your WordPress URLs. Log in to your WordPress admin, go to Settings → General, and change both the “WordPress Address (URL)” and “Site Address (URL)” to your new domain (e.g., from
http://olddomain.comtohttps://newdomain.com). Click Save. You’ll be logged out and the site will appear broken—this is expected. - Update your database with a search-replace. Using a tool like phpMyAdmin (or a plugin like “Better Search Replace”), run a search-replace on the database to replace all instances of your old domain with the new one. Important: use the full URL with protocol (e.g.,
http://olddomain.com) and be careful not to replace partial strings that could break things. If you’re not comfortable with SQL, use a plugin. - Set up 301 redirects. After updating the URLs, you need to redirect all old URLs to the new ones. If you’re using a plugin, go to its settings and add a redirect from
olddomain.com/*tonewdomain.com/*(wildcard redirect). If you’re using .htaccess, add the following code at the top (after the# BEGIN WordPressline):RewriteEngine On RewriteCond %{HTTP_HOST} ^olddomain\.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$ [NC] RewriteRule ^(.*)$ https://newdomain.com/$1 [L,R=301]Replace
olddomain.comandnewdomain.comwith your actual domains. Save the file. - Test the redirects. Visit a few old URLs (e.g.,
http://olddomain.com/contact) and ensure they redirect to the corresponding new URLs. Use a tool like Redirect Checker to confirm they return a 301 status code, not a 302 or 404. - Update internal links. Even after the database search-replace, some content (like custom code or hardcoded links) may still have the old domain. Use a plugin like “Better Search Replace” again to find any remaining old domain references in posts, pages, and options. Also check your theme files and custom CSS for hardcoded URLs.
- Update external services. Log in to Google Search Console and add the new domain as a property. Submit a change of address (under Settings) to tell Google that you’ve moved. Similarly, update your Bing Webmaster Tools. Also update any third-party services that reference your old domain, such as social media profiles, email signatures, and analytics accounts.
- Update your hosting configuration. If your new domain is on a different host, you’ll need to move your site files and database to the new host first (using the backup you made). Then point your domain’s DNS to the new host. If you’re staying on the same host, just make sure the new domain is added to your hosting account and the old one is set to redirect (or parked).
- Monitor for issues. After the switch, keep an eye on your site’s traffic, search rankings, and error logs. Use Google Analytics to see if there’s a drop in traffic—some fluctuation is normal, but a major drop could indicate a redirect issue. Check for 404 errors in Search Console and fix them by adding specific redirects.
Common Mistakes
- Forgetting to update both WordPress URL fields. If you only change one, your site may break or redirect loops may occur.
- Using 302 redirects instead of 301. A 302 tells search engines the move is temporary, so they won’t transfer ranking power. Always use 301.
- Not updating the database. If you skip the search-replace, many links and assets will still point to the old domain, causing broken images and mixed content warnings.
- Redirecting the old domain to the new homepage only. This loses the SEO value of individual pages. Use wildcard redirects to preserve the full URL path.
- Changing DNS too early. If you point your new domain to the new host before the site is ready, visitors may see a blank page or error.
Tips
- Do it during low traffic hours. This minimizes the chance of visitors experiencing errors during the transition.
- Keep your old domain active. Don’t cancel it or let it expire for at least a year after the move. Renew it so the redirects continue to work.
- Use a staging site to test. If possible, replicate your site on a staging environment and practice the domain change there first.
- Update your sitemap. Generate a new XML sitemap with your new domain and submit it to search engines.
- Notify your audience. Send an email to your subscribers and post on social media about the domain change, so your regular visitors know to update their bookmarks.
Troubleshooting
- Site shows a redirect loop. This usually happens when the .htaccess redirect conflicts with WordPress’s own redirect. Check that your .htaccess rules are placed correctly and that you haven’t accidentally left the old domain in the WordPress settings.
- Images or links still point to old domain. Run the search-replace again, but this time also search for the old domain without the protocol (e.g.,
olddomain.com) to catch any hardcoded relative URLs. Also check your theme’s functions.php or custom CSS. - Old domain shows a 404. This means the redirect isn’t working. Check that your DNS for the old domain still points to your server, and that the .htaccess file is being read (some hosts require enabling .htaccess overrides).
- Search rankings drop significantly. Wait a few days—Google may take time to process the change. If it persists, verify that your redirects are returning 301 and that you’ve submitted the change of address in Search Console. Also check for mixed content issues (HTTP vs HTTPS) if you changed protocols.
- Login page is broken. If you can’t log in after the change, edit your
wp-config.phpfile and add the following lines with your new domain:define('WP_HOME', 'https://newdomain.com'); define('WP_SITEURL', 'https://newdomain.com');Then try logging in again.
Frequently Asked Questions
Will I lose my Google rankings if I change my domain?
Not if you set up proper 301 redirects and submit a change of address in Google Search Console. It’s normal to see a temporary dip, but rankings usually recover over time.
How long does it take for Google to recognize the new domain?
It can take anywhere from a few days to a few weeks. Google needs to crawl and index the new URLs and process the redirects. Be patient and continue monitoring.
Can I change the domain without losing my email?
Email is separate from your website. If you have email associated with your old domain, you’ll need to set up new email accounts on the new domain and migrate your mailboxes. Your website change doesn’t affect email.
Do I need to reinstall WordPress on the new domain?
No. You can either move your existing installation (files and database) or use a migration plugin. Just ensure you update the URLs and redirects as described.
What if I want to keep both domains active?
You can keep the old domain and have it redirect to the new one. That’s actually recommended to preserve traffic. You can also set up the old domain to just forward, but a 301 redirect is best for SEO.
Is it better to use a plugin for redirects or .htaccess?
Plugins are easier for beginners and offer more control (like individual redirects). .htaccess is faster and doesn’t rely on WordPress, but it’s more technical. Both work well if done correctly.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.