{"id":343,"date":"2016-06-29T19:53:18","date_gmt":"2016-06-29T18:53:18","guid":{"rendered":"http:\/\/www.adienicholls.co.uk\/blog\/?p=343"},"modified":"2016-07-11T01:03:34","modified_gmt":"2016-07-11T00:03:34","slug":"changing-domains-with-wordpress","status":"publish","type":"post","link":"http:\/\/www.adienicholls.co.uk\/blog\/changing-domains-with-wordpress\/","title":{"rendered":"Site Address Change"},"content":{"rendered":"<p>As you can see this blog is now being hosted from Blog.AdieNicholls.co.uk (or AdieNicholls.co.uk\/blog).<\/p>\n<p>In the past I have moved WordPress installs from development to live and also live migrations without any issues until I came to move this site.<\/p>\n<p>I had carried out all the normal steps to moving a WP install;<\/p>\n<ul>\n<li>Backup root folder<\/li>\n<li>Backup database<\/li>\n<li>Change site location in settings&gt;general&gt;WordPress Address (URL) and Site Address (URL)<\/li>\n<li>Export database<\/li>\n<li>Upload root folder<\/li>\n<li>Import Database<\/li>\n<li>Run the following SQL command to update any paths that are outstanding:<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<pre class=\"crayon:false\">UPDATE wp_options SET option_value = replace(option_value, 'http:\/\/www.oldurl', 'http:\/\/www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';\r\n\r\nUPDATE wp_posts SET guid = replace(guid, 'http:\/\/www.oldurl','http:\/\/www.newurl');\r\n\r\nUPDATE wp_posts SET post_content = replace(post_content, 'http:\/\/www.oldurl', 'http:\/\/www.newurl');\r\n\r\nUPDATE wp_postmeta SET meta_value = replace(meta_value,'http:\/\/www.oldurl','http:\/\/www.newurl');<\/pre>\n<p style=\"text-align: left;\">With the above completed,\u00a0 I navigate to the site and run though some checks to see if the move was 100% successful as normal, erm, well this time it seems that any wp-content\/uploads links still had the old address!!! After re running the above SQL commands and that completing to result of 0 I checked and the images still had the old address&#8230; right, I am going to have to look at the instructions!!!<\/p>\n<p style=\"text-align: left;\">After a quick scan through it seems there are 2 really good tools for this job;<\/p>\n<ul>\n<li style=\"text-align: left;\"><a href=\"https:\/\/interconnectit.com\/products\/search-and-replace-for-wordpress-databases\/\" target=\"_blank\">Database Search and Replace Script in PHP<br \/>\n<\/a>Search Replace DB version 3.1.0 allows you to carry out database wide search\/replace actions that don\u2019t damage PHP serialized strings or objects with a user friendly interface and experience.<\/li>\n<\/ul>\n<ul>\n<li style=\"text-align: left;\"><a href=\"https:\/\/wordpress.org\/plugins\/better-search-replace\/\" target=\"_blank\">Better Search Replace<br \/>\n<\/a>A simple plugin to update URLs or other text in a database.<\/li>\n<\/ul>\n<p>To choose the easiest option first I installed Better Search Replace plugin for WordPress.\u00a0 A quick, no hassle install and then jump to the Tools &gt; Better Search Replace menu option<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-355\" src=\"http:\/\/www.adienicholls.co.uk\/blog\/wp-content\/uploads\/2016\/06\/BSR-600x486.jpg\" alt=\"BSR\" width=\"600\" height=\"486\" srcset=\"http:\/\/www.adienicholls.co.uk\/blog\/wp-content\/uploads\/2016\/06\/BSR-600x486.jpg 600w, http:\/\/www.adienicholls.co.uk\/blog\/wp-content\/uploads\/2016\/06\/BSR.jpg 718w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/p>\n<p style=\"text-align: left;\">Simply enter the old domain in the top box and the new name in the bottom box, ensure to tick the &#8216;Replace GUIDs&#8217; option and do a test run by selecting the &#8216;Run as a dry run&#8217; before committing to anything.<\/p>\n<p style=\"text-align: left;\">After a dry run I committed the changes, refreshed a couple of pages and everything seems to be working fine on the new domain and more importantly I don&#8217;t need to go through changing tables!<\/p>\n<p style=\"text-align: center;\">If your looking to move a WordPress installation please take a look at their <a href=\"https:\/\/codex.wordpress.org\/Moving_WordPress\" target=\"_blank\">official instructions<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As you can see this blog is now being hosted from Blog.AdieNicholls.co.uk (or AdieNicholls.co.uk\/blog). In the past I have moved WordPress installs from development to live and also live migrations without any issues until I came to move this site. I had carried out all the normal steps to moving a WP install; Backup root &hellip; <a href=\"http:\/\/www.adienicholls.co.uk\/blog\/changing-domains-with-wordpress\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Site Address Change<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":349,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"_links":{"self":[{"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/posts\/343"}],"collection":[{"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=343"}],"version-history":[{"count":6,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/posts\/343\/revisions"}],"predecessor-version":[{"id":366,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/posts\/343\/revisions\/366"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/media\/349"}],"wp:attachment":[{"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=343"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}