Changing the domain name of your WordPress website can seem like a daunting task, but with the right guidance, it becomes manageable. Whether you are rebranding, switching to a more memorable URL, or moving to a new hosting provider, updating your domain name requires careful planning and execution.
This comprehensive guide will walk you through the step-by-step process of changing your domain name on WordPress. It includes everything from preparing your new domain to updating settings and ensuring SEO continuity.
Why Change Your Domain Name?
There are various reasons why website owners decide to change their domain names. Some of the common scenarios include:
- Rebranding or changing the focus of your business
- Switching to a more SEO-friendly or memorable domain
- Correcting a typo or outdated domain
- Moving from a free domain to a custom one
Note: Changing your domain name affects your website’s traffic, SEO, and user access. Proper steps must be followed to minimize disruptions.
Step 1: Purchase and Set Up Your New Domain
Before you change your domain in WordPress, you need to register the new domain name. Many domain registrars provide easy purchasing and management options.
| Domain Registrar | Popular Features | Pricing Range |
|---|---|---|
| GoDaddy | Easy domain search, hosting integration, SSL certificates | $10 – $20 per year |
| Namecheap | Affordable pricing, free WHOIS privacy, user-friendly panel | $8 – $15 per year |
| Google Domains | Simple interface, Google services integration | $12 – $20 per year |
Once you purchase the domain, set up the DNS records to point to your hosting server. This usually involves updating the A record or changing the nameservers.
Step 2: Backup Your WordPress Website
Before making any major changes, it’s critical to back up your entire WordPress site. This includes your database, themes, plugins, and media files.
- You can use plugins like UpdraftPlus, BackupBuddy, or Duplicator.
- Alternatively, you can manually export your database via phpMyAdmin and download your
wp-contentfolder via FTP.
Warning: Skipping backups can lead to permanent data loss if something goes wrong during the domain change process.
Step 3: Update WordPress Address and Site Address
Your WordPress installation uses two important URLs: the WordPress Address (URL) and the Site Address (URL). These need to be updated to reflect the new domain.
To do this, log in to your WordPress admin dashboard and navigate to Settings > General. You will see two fields:
- WordPress Address (URL)
- Site Address (URL)
Change both URLs from your old domain to your new domain. For example, if your old domain was http://oldsite.com and your new domain is http://newsite.com, replace accordingly.
After updating these fields, save the changes. Note that you may be logged out and will need to log back in using the new domain URL.
Step 4: Update wp-config.php (Optional)
If you cannot access the WordPress admin dashboard, you can update the domain by editing the wp-config.php file directly.
Add the following lines near the top of the file, just before the line that says /* That’s all, stop editing! Happy publishing.
*/:
define('WP_HOME','http://newsite.com');
define('WP_SITEURL','http://newsite.com');
Replace http://newsite.com with your actual new domain URL. Save and upload the file back to your server.
Step 5: Update URLs in Your Database
Changing the site URL in settings only updates the basic WordPress configuration. Many links and embedded URLs in your posts, pages, and settings still reference the old domain.
You need to perform a search and replace operation on your database to update all old domain references.
- One popular tool for this is the Better Search Replace plugin.
- You can also use the
WP-CLIcommand line tool for advanced users. - Alternatively, use a PHP script like Search Replace DB to safely update URLs.
Important: Always backup your database before running search and replace operations to avoid corruption.
Step 6: Redirect Old Domain to New Domain
To preserve your SEO rankings and ensure visitors using the old domain land on your new site, implement 301 redirects.
This tells search engines that your site has permanently moved, transferring ranking power to the new domain.
Here is an example of how to redirect your old domain to the new domain using .htaccess (for Apache servers):
RewriteEngine On
RewriteCond %{HTTP_HOST} ^oldsite\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.oldsite\.com$
RewriteRule ^(.*)$ http://newsite.com/$1 [R=301,L]
If you use Nginx or other web servers, the redirect setup varies accordingly.
Step 7: Update Google Search Console and Analytics
After changing your domain, notify Google and other search engines about the change to maintain your search presence.
- Add and verify your new domain in Google Search Console.
- Use the Change of Address tool within Search Console to inform Google about the move.
- Update your website’s URL in Google Analytics settings.
These steps help Google understand your new domain is the continuation of your previous site.
Step 8: Update External Links and Social Profiles
Make a list of your important backlinks, social media profiles, and marketing materials that link to your old domain.
Wherever possible, update these links to point to your new domain to avoid losing referral traffic.
If you have an email newsletter or other communication channels, notify your audience about the domain change.
Step 9: Test Your Website Thoroughly
After completing all the above steps, thoroughly test your website to ensure everything functions correctly.
- Check that all pages load properly at the new domain.
- Verify that media files, plugins, and themes work without errors.
- Test forms, comments, and other interactive elements.
- Use tools like Broken Link Checker to find and fix any broken links.
Troubleshooting Common Issues
| Issue | Cause | Solution |
|---|---|---|
| Site redirects to old domain | Old URLs cached or redirect rules not updated | Clear browser and site cache; verify .htaccess or server redirects |
| Login issues after domain change | WordPress Address or Site Address URLs incorrect | Update URLs in settings or wp-config.php file |
| Mixed content errors (HTTP/HTTPS) | Some URLs still use old domain or HTTP protocol | Run search and replace for URLs; use SSL certificate on new domain |
| Broken images or links | Hardcoded URLs in content not updated | Perform database search and replace for old domain URLs |
Summary Checklist
| Step | Task | Status |
|---|---|---|
| 1 | Purchase and set up new domain | ☐ |
| 2 | Backup WordPress site | ☐ |
| 3 | Update WordPress Address and Site Address | ☐ |
| 4 | Edit wp-config.php (if needed) | ☐ |
| 5 | Search and replace old URLs in database | ☐ |
| 6 | Set up 301 redirects from old domain | ☐ |
| 7 | Update Google Search Console and Analytics | ☐ |
| 8 | Update external links and notify audience | ☐ |
| 9 | Test website thoroughly | ☐ |
Conclusion
Changing your WordPress domain name involves several important steps, but by following this guide, you can ensure a smooth transition. Always remember to back up your website before making changes and to verify every element afterward.
Properly redirecting your old domain and updating SEO tools helps maintain your site’s search engine rankings and provides a seamless experience for your visitors.
“A domain change is a fresh start. Handle it with care to ensure your site’s success continues uninterrupted.”