Powered by Blogger.

Update WordPress url with the new Domain Location-sql Command


To update WordPress options with the new domain location, use the following SQL command:
UPDATE wp_options SET option_value = replace(option_value, ‘old-domain’,’new-domain’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
After that, you will need to fix URLs of the WordPress posts and pages, which translated from post slug and stored in the database wp_posts table as guide field. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:
UPDATE wp_posts SET guid = replace(guid, ‘old-domain’,’new-domain’);
If you have linked internally within blog posts or pages with absolute URLs, these links will point to the wrong locations after you move the blog location. Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages:
UPDATE wp_posts SET post_content = replace(post_content, ‘old-domain’, ‘new-domain’); UPDATE wp_postmeta SET meta_value = replace(meta_value,’oldurl’,’newurl’);

No comments