How to change the domain name of a WordPress site

Need to change the name of the primary domain of your WordPress site without having to start from scratch? This tutorial is for you, We will guide you step by step to allow you to perform this operation successfully.

  1. Backing up files and databases

    To prevent data loss in the process we strongly recommend that you perform a full backup of your files and databases to avoid any loss in the process. Once the backup is done you can move your site (files + Database) from one server to another or proceed to the url change.

  2. Replace the references to the old website

    It is important to know that setting up a WordPress website is mainly in the database, which implies that any changes to the url must be made in the database.
    To indicate the changed url to WordPress we'll use SQL with the function replace () mysql.
    The first command to enter MYSQL is:

    UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-site.com', 'http://www.new-site.com') WHERE option_name = 'home' OR option_name = 'siteurl';

    This command will do the replacement of old URL by the new URL in the table wp_options

  3. Replacing the relative URL of posts

    This step is to replace in the table wp_posts all associated urls for the various posts

    UPDATE wp_posts SET guid = replace(guid, 'http://www.old-site.com','http://www.new-site.com');

    old-site.com corresponding to the URL of your old domain name and new-site.com corresponding to the URL of your new domain name.

  4. Replace the URL in the content of posts

    To ensure that all references to your old url in posts are replaced we will conduct a search / replace on all posts on the site

    UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-site.com', 'http://www.new-site.com');

    old-site.com corresponding to the URL of your old domain name and new-site.com corresponding to the URL of your new domain name.

This step closes the process. You can now use the new URL to log into your administration interface, in case you are still unable sure to clear your cache and everything should work perfectly.

  • 0 أعضاء وجدوا هذه المقالة مفيدة
هل كانت المقالة مفيدة ؟

مقالات مشابهة

How Can I Activate CloudFlare On My Hosting Account?

Connect to your cPanel Admin. Under the Software section you will find CloudFlare Subscribe...

How to Activate SourceGuardian

SourceGuardian is an encoding/decoding tool that may be required for some web applications and...

How to Add a Visitor Counter to my Web Site?

Visitor counters allow you to publicly display the number of visitors your site has obtained. The...

How to Install Web Apps Automatically with Softaculous (1-click Apps)

Softaculous is an "auto-installer" tools that can be used to install various web applications on...

Powered by WHMCompleteSolution