WordPress Domain Update and SSL SQL

To update your domain name, execute the following SQL commands in phpMyAdmin.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.olddomain.com', 'http://www.newdomain.com')
WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.olddomain.com','http://www.newdomain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.olddomain.com', 'http://www.newdomain.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.olddomain.com','http://www.newdomain.com');

Similarly, to transition your site to SSL, modify as follows. A site I’m working on also has the plugin for the yoast_seo_links table so I’m including updating that from development to production.

UPDATE wp_options SET option_value = replace(option_value, 'http:', 'https:') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http:','https:');

UPDATE wp_posts SET post_content = replace(post_content, 'http:', 'https:');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http:','https:');

UPDATE wp_yoast_seo_links SET url = replace(url, 'http://dev.domain.com', 'https://www.domain.com');

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>