How to Properly Change Domain Name for WordPress

Before you even think about changing your domain name, think ten times. Done? Is your website established and has been getting at least 300 visitors per day? If yes, think another ten times. Do you still want to do it? Okay, let’s proceed.

Sometimes it just got to happen. This website for example was rebranded twice. We have to admit, getting the right name can be difficult. This guide is suitable for both turnkey website as well as established sites.

If your site is established you are advised not to skip any of these steps. They are essential to maintain your site’s presence especially on Google Search. By ‘established’, you should have Google Search Console, Google Analytics and all the essential tools set up already.

Changing Domain Name for WordPress (Make sure to backup your website first!)

Time needed: 25 minutes.

This is the recommended step by step process.

  1. Add your new domain

    The first step is to add this new domain name to your web hosting account. Usually it is called ‘Addon domain’ and is done via Cpanel.

  2. Copy all files to your new domain folder

    Update to the latest plugins and WordPress version if you haven’t. Copy all WordPress files from your old domain folder to your new domain folder.

  3. Change Domain Name on WordPress

    Add these two lines in wp-config.php (you can find the codes here) and replace with your new url. Use “https” if your site is using https. You should be able to find wp-config.php in your wordpress installation folder.

  4. Create a New Database (Optional)

    You can create a new database for your new website and copy all the content from your old database to the new one. You must also update this new database information on wp-config.php. If this is too complicated, you may skip this step.

  5. Test if the website is working

    You should be able to access your website from your new domain name. If it’s not working, check your wp-config.php; double check the database fields.

  6. Search and Replace Everything

    Use the Search and Replace Plugin to ‘Search’ for anything that is related with your old domain name and replace with your new domain name. This is the easiest method to update any of those old blog posts that mentions your old name and replace with the new one.

  7. Redirect

    Use this code and save it as .htaccess or insert the entire thing into your current .htaccess. To create a new .htaccess, use a notepad copy and paste everything and just save it as .htaccess.

  8. Tell Google

    Use the Change of Address tool to tell Google about your new domain name change. Learn more about this process here.

Helpful Codes

Changing URL using WP-Config


.HTACCESS domain redirection

#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$$1 [R=301,L]

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *