Drupal URL Replacement Queries for MySQL

Replace Drupal development URLs with live URLs

For those of you who found our last post helpful; WordPress URL Replacement Queries for MySQL, we also often get the question about how to update URLs in Drupal after migrating from development to a live server. We feel it’s time to share a secret that will make your life a lot easier¬†than updating each and every page, post and/or custom post in your site. The answer are these WordPress URL replacement queries for MySQL.

UPDATE block_custom SET body = REPLACE(body, 'ENTER DEV BASE URL', 'ENTER LIVE BASE URL');
UPDATE field_revision_body SET body_value = REPLACE(body_value, 'ENTER DEV BASE URL', 'ENTER LIVE BASE URL');
UPDATE field_data_body SET body_value = REPLACE(body_value, 'ENTER DEV BASE URL', 'ENTER LIVE BASE URL');

Simply replace the ‘ENTER DEV BASE URL’ with the base url or your development server, for example: https://localhost/summus.io. Then, replace ‘ENTER LIVE BASE URL’ with the base url to your live server, for example: https://summus.io.