Learn How to Move a WordPress Site from One URL to Another Without Using Any Plugin

Changing domain names or shifting your WordPress site from one server to another is hectic. Definitely, we can use backup plugins to generate WordPress backups and restore them to a new server or domain. However,  free backup plugins may fail in case of transferring big websites with lots of contents, images and data. If you are in this situation and you don’t want to spend money on plugins for shifting your WordPress site from one URL to another then keep reading this article.

How to move a WordPress site from one URL to another without using any plugin?

Before jumping into the detail of this tutorial, let me list the items that we are going to do to move your WordPress site from one server to another without using any plugins.

  1. We will shift all the files from the source server to the destination server.
  2. We will download a backup of the database from phpMyAdmin and restore that on the destination server.
  3. We will run some SQL queries to change all the URLs in the database, so that it may work with the new URL.
  4. After doing #1, #2 and #3, we will modify the WP-CONFIG.PHP file with the correct database credentials.
  5. Finally, we will set up 301 redirects on the old server so that visitors coming to your old site can be redirected to the new site automatically.

Step 1: Create a ZIP of the source WordPress installation and download the ZIP.

Creating one ZIP file easy job. Just log in to your cPanel or web hosting and open the file manager app. You need to identify the root directory for your WordPress installation and create a ZIP of that folder. Once the zipping process has finished, please download the ZIP file and keep it for good.

Step 2: Download the correct database from phpMyAdmin.

Now, open phpMyAdmin from your cPanel and select the WordPress’ database from the left panel. If you are not sure which is the right database for your WordPress installation, you can find that by editing the WP-CONFIG.PHP file. Navigate to export tab after selecting the database and download a copy of the database.

Step 3: Upload and Extract the ZIP file on the new server.

Now it’s time to upload the backup ZIP file to the new server. Once you have uploaded the file, unzip the files.

Step 4: Create one database and restore the downloaded database on the new server.

The next step is to create one MySQL database and a MySQL Database user. You can use the MySQL Database Wizard inside cPanel. Once you have created the database, open phpMyAdmin from your cPanel and select the recently created database from the left panel. Navigate to the import tab and select the previously downloaded database backup file. Once the importing is finished, keep phpMyAdmin open and proceed with next step.

Step 5: Change the necessary values in the new database using SQL queries.

This is the most important stage of transferring a WordPress installation manually to another server. The WordPress database comes with old URL or domain’s values everywhere. We need to change that to the new domain using SQL queries. To do so, select the database on your left-hand side and navigate to SQL tab. Once you click on the SQL tab, you will find a text area where you can run SQL queries.

SQL Query Section

First, copy the codes below and paste it into a text editor on your computer. Replace the TABLEPREFIX with your database’s table prefix. You can find the table prefix by looking at the table names. For example, if your WordPress table names are wp_options then your table prefix is wp. Now replace the HTTP://OLDURL with the old domain name and HTTP://NEWURL with the new domain name. Once you have done that, copy and paste the updated queries into to SQL tab of your phpMyAdmin and hit go.

UPDATE TABLEPREFIX_options SET option_value = replace(option_value, 'HTTP://OLDURL', 'HTTP://NEWURL') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE TABLEPREFIX_posts SET guid = replace(guid, 'HTTP://OLDURL','HTTP://NEWURL');
UPDATE TABLEPREFIX_posts SET post_content = replace(post_content, 'HTTP://OLDURL', 'HTTP://NEWURL');
UPDATE TABLEPREFIX_postmeta SET meta_value = replace(meta_value,'HTTP://OLDURL','HTTP://NEWURL');
Step 6: Update the WP-CONFIG.PHP file

Step 6: Update the WP-CONFIG.PHP file

Once all the previous 5 steps are done, go ahead and edit the WP-CONFIG.PHP file of your new WordPress site and update the Database Name, User and Password with the new credentials that you have created. Save the file and open the site with the new URL. You need to login to the WordPress administration dashboard and update the permalink before accessing the pages. Else, it will show a 404 error. If needed, reset the admin password.

Step 7: Set up 301 redirects on the old server.

This step is easy. All you need to do is edit the .htaccess file of your old WordPress site and add the 301 redirect code. For example, if your old site was OLD.COM and the new one is NEW.NET then you need to add the code like this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^OLD\.COM$ [OR]
RewriteCond %{HTTP_HOST} ^www\.OLD\.COM$
RewriteRule ^(.*)$ "http\:\/\/NEW\.NET\/$1" [R=301,L]

Well done! You have now successfully migrated one WordPress site from one server to another without using any plugin.

We hope this article has helped you to move a WordPress site from one URL to another without using any plugin. Please share this article if you liked it.