• May 28, 2022

Backup WordPress, transfer it to a new web host and change the URL

Back up your website to your computer

  1. Download a copy of Filezilla, it’s a rock solid open source program for everyone to use for free.
  2. Obtain the current FTP information from your web host (usually found in your web host’s Control Panel information or on your web host’s website information page).
  3. Install Filezilla, when it is installed enter your FTP login information in the “Site Manager”.
  4. Make sure you can successfully connect to your hosting space and see the files displayed in the right pane.
  5. Find a suitable local backup location, preferably on a removable hard drive or on your own computer’s file system in the left pane, for example: C:UsersMeWebsiteBackup.
  6. In Filezilla with the example: C:UsersMeWebsiteBackup selected in the left side panel, right click on the root of your website directory in the right panel and choose “download”.
  7. If Filezilla asks for a duplicate file message, choose the “rename” option and simply rename the files index1.HTML, index2.HTML and so on. You can monitor completed and failed downloads in the tabs below in Filezilla.

Change your database name, username and password in Wp-Config

1. Download with FileZilla the WP-Config file in the root of your WordPress installation or edit it using the built-in editing function in your web host Control Panel. Make a copy to keep in case something goes wrong.

2. Change the following DB_NAME, DB_USER, and DB_PASSWORD values ​​to reflect your new database name, username, and password:

// ** MySQL configuration ** //

define(‘DB_NAME’, ‘The name of your database’);

define(‘DB_USER’, ‘Your database username’);

define(‘DB_PASSWORD’, ‘Your database password’)

Save your changes and re-upload the file to your hosting space if necessary, overwriting the original.

Edit your functions.php temporarily

Note: To minimize excessive linking, “*example” will be used instead of you typing your own website address complete with http:// <--- omit the periods when you type it.

1. We will inform WordPress about the domain name change without logging in with the functions.php file. This file can be found in your Wp-contents/themes/folder. If one isn’t present, you can create one using notepad or a similar program and name it functions.php.

2. Make a copy to keep in case something goes wrong. Open functions.php to edit it, either locally or by editing it in your Dashboard.

Replace the *example with your new domain name:

update_option(‘site url’,’*example‘);
update_option(‘start’,’*example‘);

3. Save your changes and re-upload the file to your hosting space if necessary, overwriting the original, or simply choose save if you’re editing within the Control Panel.

4. Access your WordPress site”*example“x3 times and then try to login”*example/wp-admin”. At this point, you will be able to log in or choose the password reset option to do so.

Now you can remove:

update_option(‘site url’,’*example‘);

update_option(‘start’,’*example‘);

From functions.php

Clean up any traces of your old domain (optional)

Note: This is optional, use it only if your website still appears to be broken.

1. We’ll use a little program called DB2 Find and Replace, grab a copy of DB2 Find and Replace here.

2. Download, extract and rename Find and Replace DB2.php to whatever you want, just leaving the .php extension.

3. Upload the renamed search-and-replace DB2.php to the root directory of your WordPress installation directory.

4. Then, in your web browser, go to *example/renamedfile.php

5. Simply follow the instructions on the screen to replace all instances of your old domain with the new one. *Note: You may have to run this a couple of times.

6. When complete, for security reasons, remove the renamed DB2 Find and Replace file from your web space.

Leave a Reply

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