{"id":122,"date":"2013-01-08T15:18:40","date_gmt":"2013-01-08T15:18:40","guid":{"rendered":"http:\/\/www.nicovs.be\/?p=122"},"modified":"2013-04-02T13:49:31","modified_gmt":"2013-04-02T13:49:31","slug":"migrating-wordpress-sites-to-another-host","status":"publish","type":"post","link":"https:\/\/www.nicovs.be\/?p=122","title":{"rendered":"Migrating wordpress sites to another host"},"content":{"rendered":"<p>When migrating wordpress sites, from one server\/host to another&#8230; you might encounter some problems with 2 things:<\/p>\n<ol>\n<li>\u00a0Absolute vs Relative paths for e.g. images<\/li>\n<li>Serialized data.<\/li>\n<\/ol>\n<p>This is how to fix both:<\/p>\n<p><strong>Absolute paths<\/strong>: can be fixed by my previous post <a title=\"Mysql: Replacing string in all tables of a database\" href=\"http:\/\/www.nicovs.be\/?p=112\" target=\"_blank\">here<\/a><\/p>\n<p><strong>Serialized Data<\/strong>: by modifying your absolute paths for URL&#8217;s of Image paths, your serialized data is no longer valid&#8230; I have found this script to be very usefull to fix the serialized data: <a title=\"BangHeadOnWall\" href=\"http:\/\/www.bangheadonwall.net\/?attachment_id=227\" target=\"_blank\">BangHeadOnWall<\/a><\/p>\n<p>How to use fix_serialization.php:<\/p>\n<p>1. Download the script on the machine that has the db you need to fix<br \/>\n2. Change a couple of things in the script:<\/p>\n<ul>\n<li>\u2018db1\u2032 to the actual database name<\/li>\n<li>username<\/li>\n<li>password<\/li>\n<li>and maybe the table\/column and index column (e.g. when using multisite)<\/li>\n<\/ul>\n<p>3. type \u2018php fix_serialization.php\u2019 on the command line<\/p>\n<p>The only real reason why I need to run this is because migrating the site can change the tite\u2019s url length or absolute image paths. \u00a0For example &#8216;hard coded&#8217; paths to images in some plugins:<\/p>\n<pre class=\"lang:php decode:true\">'\/var\/www\/vhosts\/nicovs.be\/httpdocs' -&gt; '\/var\/www\/nicovs\/be\/wwwroot'<\/pre>\n<p>The length of this string changes, and therefor the serialized string in the wp_options (or any other table using serialized string with url\/data paths) is not longer valid.<\/p>\n<p>The script goes through all that data and corrects the math in those couple of places automagically and you\u2019re back online!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When migrating wordpress sites, from one server\/host to another&#8230; you might encounter some problems with 2 things: \u00a0Absolute vs Relative paths for e.g. images Serialized data. This is how to fix both: Absolute paths: can be fixed by my previous post here Serialized Data: by modifying your absolute paths for URL&#8217;s of Image paths, your [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[3],"tags":[17,54],"class_list":["post-122","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-migrate","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.nicovs.be\/index.php?rest_route=\/wp\/v2\/posts\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nicovs.be\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nicovs.be\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nicovs.be\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nicovs.be\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=122"}],"version-history":[{"count":20,"href":"https:\/\/www.nicovs.be\/index.php?rest_route=\/wp\/v2\/posts\/122\/revisions"}],"predecessor-version":[{"id":126,"href":"https:\/\/www.nicovs.be\/index.php?rest_route=\/wp\/v2\/posts\/122\/revisions\/126"}],"wp:attachment":[{"href":"https:\/\/www.nicovs.be\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nicovs.be\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nicovs.be\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}