Delicious Brains

Documentation

Find & Replace Fields

When performing a migration you are presented with two default find and replace fields. These are essential in replacing strings that reference the old or remote website with references to the new or local website.

The two default find and replace are:

  • Site URL: any URLs referencing the old site will be replace by the new URL during the migration.
  • Root file path: any root file paths referencing the old site will be replaced by the new root file path during the migration.

The site URL find and replace field is absolutely essential as it changes the ‘siteurl’ and ‘home’ values in the wp_options table. These values must be updated during a migration to the correct value to ensure that your website loads correctly.

The root file path find and replace is mostly for 3rd party plugins that store the website’s root file path in the database. This find and replace field will ensure that these values are updated to the correct root file path during the migration.

The site url and root file path text inputs are filled in for you automatically when performing a pull or push migration. If performing an export migration you will need to fill in these inputs manually yourself.

Retrieving the “New URL” and “New file path” information

WP Migrate DB Pro should be installed and active on both the local and remote WordPress installations.

You may use one of the following methods to retrieve the “New URL” and “New file path” information:

Method 1

  1. Login to the remote site
  2. Navigate to WP Migrate DB Pro plugin page (Tools → Migrate DB Pro)
  3. Copy the contents of the first field under the “Find” header (remote URL)
  4. Switch back to your local site
  5. Paste into the “New URL” field
  6. Switch back to the site you logged into during step 1
  7. Copy the contents of the second field under the “Find” header (remote file path)
  8. Switch back to your local site
  9. Paste into the “New file path” field

Method 2

  1. Login to the remote site
  2. Navigate to WP Migrate DB Pro plugin page (Tools → Migrate DB Pro)
  3. Switch to the Settings tab
  4. Highlight and copy the “Connection Info” into your clipboard
  5. Switch back to your local site
  6. Click the “Pull” radio button
  7. Paste into the textarea below the “Pull” radio button
  8. You will be connected to the remote site
  9. Switch back to the “Export File” radio button (if desired)
  10. Both the find and replace sections should now be completely filled in

Custom Find and Replace Fields

Occasionally you might need to specify a custom find and replace field. To do this simply click the “Add Row” button below the existing find and replace fields to create a new one.

wpmdb-find-and-replace

A prime example of why you’d want define additional find and replaces is if you have references to your site’s URL in your database that slightly differ in format to your main site’s URL.

Consider the following:

Your website’s URL is: http://example.com

Your default replace will match your site’s protocol-relative URL. So if you have references to your site using a sub-domain these URLs will not be replaced during a migration using the default find and replace fields.

For example, http://www.example.com will not be replaced during a migration.

To have those values replaced during the migration you’ll need to add additional find and replace fields to have those slightly different URLs replaced.

For example,

  • Find //www.example.com replace with //example.com