My 10-step process for changing your website domain name.
DISCLAIMER: if you’re trying to learn how to do this yourself for a really important site, please don’t! Hire a developer. It might take them a good 2-4 hours and they might even notice other little issues that you don’t. Please don’t try screw around if you don’t have experience here. I see people mess around and try to DIY, then jack up their SEO rankings that they’ve built up over the years. Don’t be an idiot!
STEP 1 – decide on domain name
Are you sure? ARE YOU REALLY SURE? Cuz it’s a pain in the ass to recover from one change…and even more so if you do multiple changes in such a short time. Not only more work to do, but also more chances to screw up.
- Please tell me it’s gonna be https://yourdomain.com (no “www” in front as that’s outdated now).
- Are you changing it to something like “theredsquirrel.com”? Cuz what if customers type only “redsquirrel.com”? Getting “redsquirrel.co” ain’t gonna help you too much there either.
Anyway, this isn’t supposed to be a domain name picking lesson. Just think your decision through several times!
STEP 2 – add new domain to your webhosting
- If you’re using cPanel, it’s a matter of adding it to “Addon domain”.
- If you’re using another interface, follow their guide for adding new domains/sites to your account.
- Don’t forget to generate SSL for new domain.
This is all assuming you’re keeping the same webserver and webhosting account, right?
STEP 3 – migrate website to new domain name
Usually when you add a new domain, it creates a new directory for you to place your website files.
- Copy (or move) your files to the new directory.
As for database, you have some options:
- Use existing database (maybe rename it if you need) if your webhosting account allows all websites to access all database…like cPanel.
- Create new database (exporting from old, import into new) if your webhosting has isolated accounts for each website. In which case you have to create new database AND database user.
- If you had to create a new database/user then update the database credentials in your wp-config file.
This step is basically like migrating a website to a new webserver, but instead you’re just migrating it to a new domain name.
STEP 4 – change site URL in WordPress settings and database
When you first try to load your website from the new domain, it’ll probably keep redirecting to the old domain (which is normal). There are still several steps to do.
- Change WordPress/site address in WordPress settings – ideally, you’d logged into your site and change it from the backend. But until you get in, you either have to edit it from the wp_options table in database or specify site address/url in your wp-config.php file. (I prefer database route.)
STEP 5 – change site URL in database
Now you have to update all your strings in database so your site is looking for posts and images files from the correct URL. Easiest way is to install “Better Search Replace” and put old domain in FROM and new domain in TO.
- I highly recommend the format of “olddomain.com” and “newdomain.com”.
- Do not do just “olddomain” and “newdomain” as that may cause more trouble.
If for whatever reason your database is too big and search/replace doesn’t work, go get a developer and let them update manually from SQL queries in phpMyAdamin.
STEP 6 – update your htaccess
Make sure any references to your old domain are updated to the new one.
STEP 7 – update Google Search Console
Update your website settings in Google Search Console and also Google Analytics to use your new domain name!
STEP 8 – redirect old domain to new one
Ideally, this is most efficiently done from your domain registrar or DNS provider (if using Cloudflare) rather than from your web-server since that would use up your web server processing power. Make sure it’s a 301 permanent redirect for anything from old domain to new domain.
STEP 9 – check for errors
- Check for broken links – there are free tools online and even downloadable desktop apps.
- Monitor your Google Search Console for any errors/404/etc.
- Monitor your Google Analytics for decreased traffic.
STEP 10 – enjoy life
Don’t forget to slap yourself for trying to do this alone instead of hiring a developer to handle for you.