How to Change the Domain Name for your WordPress Based Website

1. Add new domain to Web Host Account

  1. Login to cPanel, click on Add On Domains

  2. On the next screen, complete the form to add your new domain.

2. Update Nameservers for the new domain

  1. We highly recommend using Cloudflare.
    1. Instructions to setup Cloudflare.
    2. Save the two nameserver addresses that Cloudflare provides.
  2. Go to your domain registrar (i.e GoDaddy, Network Solutions, etc) and update the Nameservers for your new domain. Use the nameserver addresses that Cloudflare provided.
    1. Search Google to get exact instructions for updating the nameservers for your particular domain registrar.
  3. Setup Cloudflare for WordPress.

3. Update the Site Address (URL) within WordPress

  1. Enter the new domain name in the field named Site Address (URL)

4. Create a new file named index.php in the folder for the new domain

  1. Use FTP, or the File Manager within cPanel to navigate to the new folder that was created for the new domain name. In this example, the folder name for the new domain name is: YourNewDomainName.com


  2. Create a new file named index.php


5. Update the index.php file

  1. Paste the following code into the file:
    <?php
    /**
    * Front to the WordPress application. This file doesn’t do anything, but loads
    * wp-blog-header.php which does and tells WordPress to load the theme.
    *
    * @package WordPress
    */
    
    /**
    * Tells WordPress to load the WordPress theme and output it.
    *
    * @var bool
    */
    define(‘WP_USE_THEMES’, true);
    
    /** Loads the WordPress Environment and Template */
    require('/home/example/public_html/YourNewDomainName.com/wp-blog-header.php');
  2. Find this line:
    require('/home/example/public_html/YourNewDomain.com/wp-blog-header.php');
  3. Change “YourNewDomain.com” to the directory where WordPress is currently installed.
    require('/home/example/public_html/YourOriginalDomainName.com/wp-blog-header.php');
  4. Save Changes in Editor. Then Close the Editor.

6. Create a new file named .htaccess in the folder for the new domain

  1. Use FTP, or the File Manager within cPanel to navigate to the new folder that was created for the new domain name. In this example, the folder name for the new domain name is: YourNewDomainName.com
  2. Create a new file named .htaccess

7. Update the .htaccess file

  1. Add the following code to the .htaccess file:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

8. Clear the Cache in your browser and reload the website using the new domain name

9. Force the website to load via SSL.

  1. Cloudflare provides a free flexible SSL. We recommend using the Really Simple SSL plugin to force the website to load via SSL.
  2. You may need to wait a few hours to complete this step since the nameserver update may take time. You can check if SSL is ready to use by typing https:// in front of your domain name. If the website loads, it’s ready to go. You’ll see a browser error if SSL is not ready to use.
2017-11-09T05:33:24+00:00