Changing your WordPress domain is a big decision. Like moving to a new town or city, it’s both frightening and exciting. It’s also a pretty hefty task, and not to be done lightly. If you’ve decided to change your WordPress site’s domain it’s usually for a good reason. Perhaps because your company is rebranding or a more popular domain has become available.
So, whether you’re turning a new leaf or finally securing the domain you always wanted, we’re going to walk you through all the steps to successfully changing your WordPress domain name.
Before You Get Started
- The first thing you should do is back up your site. A lot of things can go wrong when changing domains and if you somehow break your site, you’ll be thankful that you didn’t lose everything. There’s nothing worse than rebuilding months of hard work from scratch.
There are a few WordPress plugins you can use to do this step. Or, if you prefer, you can backup manually.
- Next, consider how you want to approach this. You can either change the domain of your existing site or you can create a new site and copy over the data from the old one.
If you’re not making other major changes, then you can just change the domain and keep your original site. However, if you’re going to change a lot of other things about the site (design, layout, etc.) you might want to consider using a brand new site. With this option, you can just copy over the parts you want to keep into the new template.
How To Change Your WordPress Domain Name
To change your URL, simply navigate to the Settings in your WordPress dashboard. Under General Settings, you’ll be given the options to change WordPress Address and Site Address.
- The site address is what people type to access your site.
- WordPress address is where the core files are stored.
Unless you’ve installed WordPress in a separate directory, these two should match. Now you can just type the new URL in both fields and hit “Save Changes”.
Make sure to include the “http://” part of the URL and don’t add a “/” at the end.
Once this is done, your domain name will be changed but there are a few more things you’ll need to do for your new WordPress domain to work properly.
Note that your site’s back end will be inaccessible until you’ve done the rest of the steps.
Updating Links
Now you need to update any hard-coded links to your old WordPress URL. These are links written into the source code of your site, for example, other pages that contain links to your home page.
Of course, now that you’ve changed the domain all of these links will be obsolete and broken.
If you have a very small site or an infinite amount of time and patience, you can just go and update every link manually. If you want to stay relatively sane, however, it’s best to use a plugin to perform a search and replace.
Some plugins you can use are:
With these plugins, you can simply enter your old URL to locate every instance of it in the code and automatically replace it with the new one.
Adding 301 Redirects
This is possibly the most important part of the process. Why? Well, over time your WordPress site will have (ideally) been linked to by other sites. These are known as “backlinks” and are tremendously important for your SEO.
Backlinks & SEO
Backlinks play a significant role in how Google determines your ranking. Essentially, the more sites link back to yours, the more “link authority” you have, meaning Google sees you as trustworthy. Furthermore, if sites with high link authority link to you, that means a huge boost for your SEO.
When you change your WordPress domain, those links will be broken and you’ll lose all that lovely linking authority. This is where 301 redirects come in.
What is a 301 Redirect?
A redirect is pretty self-explanatory: it redirects you from one URL to another. There are a few different types of redirects that do slightly different things.
- 302 Redirect. This is a temporary redirect. You might use this if you’re doing maintenance on your site and want to direct visitors to a different page in the meantime.
- Wildcard (catch-all) Redirect. This type of redirect can direct users to a page in spite of their original request. This can be used for misspelt URLs or pages that don’t exist anymore.
- 301 Redirect. This signals a permanent change of URL.
Now, these redirects do more than just take visitors to the new site. They also guide search engine crawlers. This is where the difference between temporary and permanent redirects matters.
For a 302 redirect, the message to the crawlers is that the page it’s redirecting from will be restored soon. Therefore it remains in Google’s index and none of the link value is passed on to the redirect URL.
With a 301 redirect, you send a message to crawlers that your WordPress site has moved permanently, the old page is removed from the index and most of its link value carries over to the new page. Note that this isn’t an immediate change, so it’s normal to see a drop in rankings while Google indexes your new site.
Hanging On To Your Old Domain
After you change your WordPress domain, you’ll need to keep your old domain as well otherwise the redirects won’t work. You should also keep an SSL certificate on the site as this is a prerequisite for the redirects to function. (You don’t need to keep all your content on the site, though.)
There are a few other benefits to keeping your old URL, which is why Google recommends you hang onto it and keep the redirects up for at least 180 days. Firstly it takes a while for the crawlers to index your new site. For a medium-sized website, it can take a couple of weeks.
Secondly, your visitors might still be accessing your site via the old URL. You can monitor how much of your traffic is still coming from redirects and decide whether or not to keep them up for longer.
Finally, there are security benefits to hanging on to the old domain. If you stop renewing the old domain, it can be bought by anyone and someone with malicious intentions could do a lot of damage to your business.
People could use the site to impersonate you, as owning the domain lets them make email addresses with it. They could even put up their own redirects to send visitors to a different page. There’s almost no scenario where someone is going to do this for a nice reason. At best it’s a competing website stealing your link ratings and at worst it’s someone trying to scam your customers/visitors.
How To Create 301 Redirects In WordPress
Add 301 Redirects Manually
You can manually insert 301 redirects by going into your htaccess file. Then enter the following:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.newdomain.co.uk
RewriteRule (.*) http://www.newdomain.co.uk/$1 [R=301,L]
You should then host this htaccess file on your old domain.
The problem that often presents itself, however, is when the new domain has a different linking structure. For example, your old site may have had the subdomain: “example.com/store” to access the shop and this has now changed to “example.com/products”.
The code above works on the assumption that the domain is the only thing you have changed. If you’re changing the link structure, you’ll need to redirect each page individually, following this format:
redirect 301 /old-page-1.html http://newsite.com/new-page-1
Add 301 Redirects With Plugins
This process can be made easier by using WordPress plugins. The plugin library offers a range of free and premium services that can insert redirects for you without you needing to manually alter the htaccess file.
Some of the best redirection plugins available are:
- Redirection (FREE)
- Simple Website Redirect (FREE)
- Safe Redirect Manager (FREE)
- YoastSEO (Redirects are only available in the Premium version)
Troubleshoot
Once you’ve set up the redirects, spend some time making sure they work. One way to do this is to enter “site:yourolddomain.com” into google to see all your old domain’s indexed pages and start clicking to see if they redirect to your new domain. You can also use services like Xenu to find any broken links on your site.
Updating Your Changes In Google
- Change Your Address In Google Search Console
Changing your address in Google Search Console will make it easier for Google to move your search results to the new site.
For this step, you’ll need to be verified for both your old and new domain in the GSC. Go to your old domain’s profile and select “Change Of Address” from the Settings drop-down menu. Now follow the instructions on the screen to update your domain.
- Add A New Sitemap
Your sitemap is simply a list of URLs that you want Google to crawl. Note: while this is helpful for indexing, it is not a replacement for link hierarchy and robots tags. To view your sitemap, simply go to “yourdomain.com/sitemap.xml”. Submit this sitemap to Google Search Console by going to “Inputs” then “Sitemaps” and entering the sitemap URL.
- Update Google Analytics
To monitor your SEO and performance on the new site, update your URL in Google Analytics by going to Admin and then Property Settings. Then, it’s recommended to connect your updated Analytics to your Search Console. You can do this by clicking “Adjust Search Console.”
Troubleshooting And A Few Other Tips:
- If you’re migrating a large site over to a new domain, you might want to start by moving a single relatively static subdomain to see how it affects traffic and search rankings. You can move the rest of the site in sections too.
- Try and move your site when there’s lower traffic to minimise disruptions to the user experience.
- Double-check your robots.txt. Usually, people use robots tags to block a site from crawlers while it’s in development. Make sure you change this when you launch your site.
- If you’ve recently bought the new WordPress domain, make sure there aren’t any issues left over from the previous owner. Check the Search Console to see if any actions were taken against the domain for things like spam. Also, look for any URLs that were blocked by the previous owner.
And You’re Good To Go!
As you can see, there’s a lot of work that goes into ensuring a smooth transition over to a new domain. There are a lot of T’s to cross and i’s to dot. As long as you familiarise yourself with all the steps beforehand, pay attention, and troubleshoot, the process can be fairly painless and at the end of the day, you’re sitting pretty on a fresh new WordPress domain!
Still hungry for WordPress tips? Check out our blog for more web development guides!