Ready to learn how to change your primary domain on WordPress? Things can get a little technical here, but by following these steps closely, the process will be seamless.
1. Change the Domain in WordPress
Log into your WordPress account, and from the dashboard, go to Settings > General. Change both the WordPress Address and Site Address to your new domain name, then save.
2. Update the wp-config.php
What is the wp-config.php? This is a crucial file in your WordPress installation that contains important data and configuration information from your website.
To access and update this with your new domain, you'll need to find your FTP credentials from your hosting provider. Once you have access to the FTP, go to public_html > wp-config.php, then right-click the file and select Edit. What you will see is:
define('WP_HOME','http://yoursitename.com');
define('WP_SITEURL','http://yoursitename.com');
Change ‘yoursitename' to the new domain name, then save.
3. Update the WordPress Database
Go to your hosting control panel and find phpMyAdmin. Find wp_options, then type your new domain into ‘siteurl' and ‘home'. Click Go to save.
4. Redirect the Former Domain
It's time to ensure your old website is redirected to the new website, as audiences might still stumble upon your old URL or forget that you've changed to a new domain. By redirecting, they can type in the old domain and still end up on your new domain.
To set up these 301 redirects, as they are called, go to your hosting control panel and choose the file manager. Go to the .htaccess folder, and right-click to edit. Add the following code, changing ‘newdomain' to your new domain, to the top of the page:
#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
5. Notify Search Engines
Search engines, particularly Google, have tools to change your site address. You'll fill out a simple form to notify search engines of the change, so they can direct search traffic to your new domain name. Make sure you fulfill the requirements for Google here, then access the Change of Address tool here.