Subscribe to Our Mailing List and Stay Up-to-Date!
Subscribe
Migration & Deployment

How to Change WordPress Domain Name Without Breaking Your Site

Changing your WordPress domain name is nerve-wracking. One wrong step and you break links, lose SEO rankings, or corrupt your database. But sometimes domain changes are necessary—rebranding, upgrading to better TLD, or correcting naming mistakes. This complete guide shows you how to change domains safely while preserving SEO and avoiding broken links.

Common Reasons for Domain Changes

Rebranding: Company name changes require matching domain. TechSolutions.com becomes InnovateCorp.com after rebranding.

Better TLD: Upgrading from .net to .com after finally acquiring the .com version. Or switching to newer TLDs (.io, .co, .ai) for positioning.

Business Acquisitions: Merged companies consolidate under single domain. AcquiredCompany.com content moves to ParentCompany.com.

Geographic Expansion: Adding country-specific domains. Example.com expands to Example.co.uk for UK market.

Correcting Mistakes: Original domain had typo, was too long, or doesn’t reflect current business. MyAwesomeWordPressSiteBlog2019.com was a mistake.

SEO Strategy: Moving from aged domain with baggage (penalties, bad backlinks) to clean domain.

Whatever your reason, proper planning prevents disaster.

Why Domain Changes Are Risky

WordPress stores URLs in multiple locations:

Database: Posts, pages, comments, options, media library all contain full URLs. Approximately 200+ database references to domain in typical site.

Serialized Data: Plugin settings, theme options, widget configurations use PHP serialized arrays containing URLs. Simple find-replace breaks serialization.

File Paths: Hard-coded URLs in themes, custom code, CSS files referencing domain.

External References: Backlinks from other sites, social media shares, search engine indexes, email links all point to old domain.

Email Configuration: Email addresses (@olddomain.com), SMTP settings, notification configurations tied to domain.

Change domains incorrectly and you experience: – White screen of death – Broken images and media – Non-functional plugins – Lost customizations – Dropped search rankings – Lost email – Broken checkout (e-commerce)

Pre-Migration Planning

Before touching anything, plan thoroughly:

Choose New Domain: Purchase and verify ownership of new domain. Have DNS access ready.

Pick Migration Date: Choose low-traffic period. Avoid holidays, sales events, product launches. Wednesday 2 AM is ideal for most sites.

Document Current Setup: – Current domain and all variations (www, non-www, https, http) – All subdomains (shop.olddomain.com, blog.olddomain.com) – Email accounts and configurations – External services using current domain – Current SEO metrics (rankings, traffic, backlinks)

Notify Stakeholders: Inform team, customers (if appropriate), service providers about upcoming change.

Create Comprehensive Backup: Full site backup including database and all files. This is your rollback plan if anything goes wrong.

Understanding WordPress URL Storage

WordPress stores URLs in specific places:

wp_options Table: – siteurl: WordPress installation URL – home: Homepage URL – These two settings control primary domain configuration

wp_posts Table: – post_content: Post and page content containing links and embedded media – guid: Permanent unique identifier (never changes, but shows old domain)

wp_postmeta Table: – Serialized data in plugin settings – Custom fields containing URLs

wp_comments Table: – comment_author_url: Commenter websites – comment_content: URLs in comments

wp_usermeta Table: – User profile data potentially containing URLs

Theme/Plugin Files: – functions.php with hard-coded URLs – CSS files with domain references – JavaScript configuration

Complete find-replace must cover ALL these locations.

Step-by-Step Domain Change Process

Follow this procedure exactly:

Step 1: Create Fresh Backup 1. Use Backup Copilot Pro to create complete backup 2. Download backup to local computer 3. Verify backup is complete and uncorrupted 4. Keep old domain operational during process

Step 2: Set Up New Domain 1. Point new domain DNS to your hosting server 2. Add new domain to hosting account 3. Install SSL certificate for new domain 4. Test new domain resolves correctly (may take 24-48 hours for DNS propagation)

Step 3: Create Staging Copy (Recommended) 1. Create staging subdomain (staging.newdomain.com) 2. Restore backup to staging 3. Test domain change on staging before production 4. This provides safe testing environment

Step 4: Database Find-Replace

Using Search-Replace-DB Script (Recommended): 1. Download from https://github.com/interconnectit/Search-Replace-DB 2. Upload to WordPress root directory 3. Access via browser (yourdomain.com/Search-Replace-DB/) 4. Enter old URL: https://olddomain.com 5. Enter new URL: https://newdomain.com 6. Click “Dry run” to preview changes 7. Review what will change 8. Click “Live run” to execute replacement 9. Delete script immediately after (security risk if left accessible)

Using WP-CLI (Command Line):

wp search-replace 'https://olddomain.com' 'https://newdomain.com' --all-tables

Important: Always use full URLs (https://olddomain.com) not just domain (olddomain.com). This prevents false positives.

Step 5: Update wp-config.php

Add these lines to force new domain:

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

This overrides database settings ensuring consistency.

Step 6: Update .htaccess for Permalinks

Regenerate permalink structure: 1. Log into WordPress admin at https://newdomain.com/wp-admin 2. Navigate to Settings → Permalinks 3. Click “Save Changes” without changing anything 4. This regenerates .htaccess with correct domain references

Step 7: Verify SSL Certificate

  1. Install/configure SSL for new domain if not done
  2. Test https://newdomain.com loads with green padlock
  3. Fix mixed content warnings (HTTP resources on HTTPS pages)
  4. Update any hard-coded HTTP links to HTTPS

Step 8: Test Everything

Thoroughly test before announcing: – [ ] Homepage loads correctly – [ ] All pages accessible – [ ] Images display (check media library) – [ ] Forms submit successfully – [ ] Search works – [ ] User login/registration works – [ ] E-commerce checkout completes (test mode) – [ ] Admin area fully functional – [ ] Mobile site responsive

Fix any issues before redirecting old domain.

Setting Up 301 Redirects

Preserve SEO by redirecting old domain to new:

In .htaccess on Old Domain:

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

This redirects every page on old domain to corresponding page on new domain. 301 status tells search engines the move is permanent.

Keep Redirects Active: Maintain redirects for minimum 1 year, preferably indefinitely. Many backlinks and bookmarks point to old domain.

Redirect All Variations: Ensure www.olddomain.com, olddomain.com, http://olddomain.com ALL redirect properly.

Preserving SEO Value

Domain changes risk losing search rankings. Minimize impact:

Use 301 Redirects: Properly implemented 301 redirects pass 90-99% of link equity to new domain.

Notify Google: Use Google Search Console Change of Address tool: 1. Add and verify new domain in Search Console 2. Go to Settings for old domain property 3. Click “Change of Address” 4. Select new domain from dropdown 5. Submit request

Update Backlinks: Contact major sites linking to you and request they update links to new domain. Focus on high-authority backlinks.

Update Social Profiles: Change Facebook, Twitter, LinkedIn, Instagram profiles to reference new domain.

Maintain Content: Don’t change content during domain migration. Search engines need consistency to understand the move.

Monitor Rankings: Track keyword rankings before and after migration. Expect temporary fluctuations but should stabilize within 2-4 weeks.

Submit New Sitemap: Generate new XML sitemap with new domain and submit to search engines.

Updating External Services

Many services reference your old domain:

CDN Configuration: – Update Cloudflare/BunnyCDN to point to new domain – Update DNS records – Regenerate SSL certificates

Email Services: – Update SendGrid/Mailgun domain verification – Reconfigure SPF/DKIM records for new domain – Update SMTP settings in WordPress

Payment Gateways: – Update Stripe webhook URLs – Update PayPal IPN/return URLs – Update authorized domains for payment processors

Analytics: – Update Google Analytics property URL – Reconfigure Goal URLs – Update tracking code (usually automatic)

Social Media Integration: – Update Facebook App domains – Update Twitter card metadata – Reconnect social sharing plugins

Third-Party APIs: – Update authorized domains in API dashboards – Regenerate API keys if domain-locked – Update webhook endpoints

Handling Subdomains

If you have subdomains, migrate them too:

  • shop.olddomain.com → shop.newdomain.com
  • blog.olddomain.com → blog.newdomain.com

Options: 1. Keep Subdomains: Maintain same structure on new domain 2. Consolidate: Move subdomains to subdirectories (blog.old.com → new.com/blog/) 3. Separate Sites: Keep subdomain content on old domain with redirects

Each subdomain requires its own find-replace and redirect configuration.

Email Considerations

Domain change affects email:

Email Addresses: info@olddomain.com becomes invalid. Options: 1. Forward Old to New: Set up email forwarding from old to new domain 2. Maintain Both: Keep old domain active for email only 3. Migrate Completely: Update all email addresses, notify contacts

Email Notifications: Update WordPress email settings to send from @newdomain.com. Update “From” addresses in WooCommerce, contact forms, membership plugins.

Testing Before DNS Changes

Test thoroughly while old domain still active:

Hosts File Testing: Edit your computer’s hosts file to preview new domain before DNS changes: – Windows: C: – Mac/Linux: /etc/hosts

Add line:

123.456.789.012 newdomain.com www.newdomain.com

(Replace with your server’s IP address)

This lets YOU see new domain while rest of world still sees old domain. Test everything before making DNS changes public.

##Common Pitfalls and Troubleshooting

Issue: White screen after domain change Cause: Serialized data corruption from improper find-replace Solution: Use proper database search-replace tool that handles serialization

Issue: Images not loading Cause: URLs in content still reference old domain Solution: Run find-replace again, check theme files for hard-coded URLs

Issue: Can’t login to admin Cause: Browser cookies tied to old domain Solution: Clear browser cookies, try incognito mode

Issue: SSL warnings Cause: Mixed content (HTTP resources on HTTPS pages) Solution: Use Really Simple SSL plugin or manually find HTTP references

Issue: Plugins not working Cause: Plugin settings contain old domain in serialized data Solution: Reconfigure plugins, some may need manual setting updates

Issue: Lost search rankings Cause: 301 redirects not set up properly or broken Solution: Verify redirects working, check Search Console for errors

Post-Migration Monitoring

After migration, monitor closely:

First Week: – Check Google Search Console daily for crawl errors – Monitor traffic in Google Analytics (expect temporary dip) – Test all major functions daily – Respond quickly to user-reported issues

First Month: – Track keyword rankings (should recover within 2-4 weeks) – Monitor backlink changes – Watch for broken links in Search Console – Review server error logs

Ongoing: – Keep 301 redirects active indefinitely – Update old marketing materials gradually – Continue monitoring SEO metrics quarterly

Conclusion

Changing WordPress domains is complex but manageable with proper planning. The keys are comprehensive backups, proper database find-replace that handles serialization, correct 301 redirects, and thorough testing before going live.

Don’t rush. Take time to test on staging. Verify every major function works. Set up redirects properly. Notify search engines. Monitor post-migration.

With Backup Copilot Pro, you have safety net. If anything goes wrong, restore from backup and try again. Domain changes don’t need to be terrifying when you have reliable backups and tested procedures.

  1. WordPress Change Site URL
  2. 301 Redirects for SEO
  3. Google Search Console Site Move
  4. Database Search Replace Tool
  5. Domain Migration SEO Guide

Call to Action

Changing domains? Backup Copilot Pro makes it easy with built-in find-replace, pre-migration backups, and one-click rollback. Migrate safely and confidently—start your free trial!