{"id":2468,"date":"2013-11-20T22:49:11","date_gmt":"2013-11-20T22:49:11","guid":{"rendered":"http:\/\/www.softwareeverydayblog.com\/?p=2468"},"modified":"2013-11-21T09:01:11","modified_gmt":"2013-11-21T09:01:11","slug":"wordpress-backup","status":"publish","type":"post","link":"https:\/\/www.softwareeverydayblog.com\/?p=2468","title":{"rendered":"WordPress Backup"},"content":{"rendered":"<p><strong><a href=\"http:\/\/wpmu.org\/import-export-wordpress-sites-multisite\/\" title=\"import-export-wordpress\" target=\"_blank\">WordPress Import\/Export<\/a><\/strong><br \/>\nWordpress allows you to export your &#8216;content&#8217; in xml format. it then allows you to imports that content in a wordpress instance. The tool allows you to import data from various sources (e.g. Live Journal, Tumblr etc). Seems quite straightforward however the wordpress import\/export have some caveats.<\/p>\n<ol>\n<li>It requires you to add users on the site before you import.<\/li>\n<li>If the exported file is very large, the import script may run into your host&#8217;s configured memory limit for PHP.<\/li>\n<li>If the import process is run again with the same data file after stopping midway through, it could result in duplicate data, missing data or other errors in the destination database.<\/li>\n<li>Some <a href=\"http:\/\/wordpress.org\/support\/topic\/does-not-import-images-file-attachements\" title=\"does-not-import-images-file-attachements\" target=\"_blank\">discussion<\/a> about whether this process does or does not import images, files (or content in general).  In my experience the imported posts have links to content residing in the wp-content of the site that I exported from.<\/li>\n<\/ol>\n<p><strong>Manual Import Export<\/strong><br \/>\nI instead choose to do a manual import export of my wordpress blog. Below are the steps that i carried out an exact clone of my blog www.softwareeverydayblog.com on my local box.<\/p>\n<ol>\n<li>Take a mysql backup of the my wordpress DB.<\/li>\n<p><a href=\"https:\/\/www.softwareeverydayblog.com\/wp-content\/uploads\/2013\/11\/mysql_backup.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.softwareeverydayblog.com\/wp-content\/uploads\/2013\/11\/mysql_backup.jpg\" alt=\"mysql_backup\" width=\"509\" height=\"345\" class=\"alignnone size-full wp-image-2469\" srcset=\"https:\/\/www.softwareeverydayblog.com\/wp-content\/uploads\/2013\/11\/mysql_backup.jpg 1017w, https:\/\/www.softwareeverydayblog.com\/wp-content\/uploads\/2013\/11\/mysql_backup-300x203.jpg 300w\" sizes=\"auto, (max-width: 509px) 100vw, 509px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.softwareeverydayblog.com\/wp-content\/uploads\/2013\/11\/mysql_backup2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.softwareeverydayblog.com\/wp-content\/uploads\/2013\/11\/mysql_backup2.jpg\" alt=\"mysql_backup2\" width=\"450\" height=\"228\" class=\"alignnone size-full wp-image-2470\" srcset=\"https:\/\/www.softwareeverydayblog.com\/wp-content\/uploads\/2013\/11\/mysql_backup2.jpg 450w, https:\/\/www.softwareeverydayblog.com\/wp-content\/uploads\/2013\/11\/mysql_backup2-300x152.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<li>Manually create a database &#8216;softwareeveryday&#8217; on my local mysql instance. Import the db using the mysql back script into this fresh db &#8216;softwareeveryday&#8217; that we just created.<br \/>\n<strong>C:\\scipts>c:\\wamp\\bin\\mysql\\mysql5.5.24\\bin\\mysql -u root -p < softwareeveryday.sql softwareeveryday<\/strong><br \/>\nEnter password:\n<\/li>\n<li>Copy the wordpress files using FTP somewhere into our apache home directory. Change wp-config.php to reflect local box settings.<\/li>\n<li>At this point, we bring up our apache server and the wordpress blog should appear. There is one issue, there are yet some references to https:\/\/www.softwareeverydayblog.com. We&#8217;ll need to make some changes in the database to get rid of those references. Change wp_options table, set wp_options to point to localhost address where option_name is &#8216;siteurl&#8217;, &#8216;home&#8217;.<\/li>\n<li>All the content that I uploaded (like images) is yet pointing to https:\/\/www.softwareeverydayblog.com\/wp-content\/uploads\/2013\/05\/some_image.jpg. Now I notice that within the wp_posts, all posts have href hardcoded to softwareeverydayblog.com. You can use this <a href=\"http:\/\/interconnectit.com\/products\/search-and-replace-for-wordpress-databases\/\" title=\"search-and-replace-for-wordpress\" target=\"_blank\">tool<\/a> to replaces the urls. The advantage over SQL replace is that the tool know how to handle serialized info in the DB. Refer to <a href=\"http:\/\/wordpress.stackexchange.com\/questions\/123852\/clone-wordpress-blog-on-localbox-manually\/123875\" title=\"clone-wordpress-blog-on-localbox-manually\" target=\"_blank\">stackoverflow<\/a> answer for more.<\/li>\n<\/ol>\n<p>If you want to skip the last step of making DB changes, we could change our hosts file so that requests to softwareeverydayblog.com point to 127.0.0.1. I personally prefer to change my hosts file. I also soon realized that it\u2019s NOT possible to redirect using hosts file. For example the following entry is NOT possible.<\/p>\n<pre lang=\"text\"> \r\n# redirects not allowed in hosts file\r\n127.0.0.1\/softwareeverydayblog\/wordpress-3.4.2\/\t\tsoftwareeverydayblog.com\r\n<\/pre>\n<\/li>\n<p>Instead we could add a simple hosts entry, and add redirects in the local apache server to redirect all requests to softwareeverydayblog.com to the wordpress directory.<\/p>\n<ol>\n<li>Add the following entries in hosts file.\n<pre lang=\"text\"> \r\n127.0.0.1\t\twww.softwareeverydayblog.com\r\n127.0.0.1\t\tsoftwareeverydayblog.com\r\n<\/pre>\n<\/li>\n<li>Add the following entry to httpd-vhosts.conf for redirects. With this all requests to softwareeverydayblog.com on this apache server will be served files from &#8220;C:\/www\/softwareeverydayblog\/wordpress-3.4.2&#8221; which is our wordpress directory.\n<pre lang=\"xml\"> \r\n<VirtualHost *:80>\r\n    ServerAdmin webmaster@dummy-host.example.com\r\n    DocumentRoot \"C:\/www\/softwareeverydayblog\/wordpress-3.4.2\"\r\n    ServerName softwareeverydayblog.com\r\n    ServerAlias www.softwareeverydayblog.com\r\n    ErrorLog \"logs\/softwareeverydayblog.com-error.log\"\r\n    CustomLog \"logs\/softwareeverydayblog.com-access.log\" common\r\n<\/VirtualHost>\r\n<\/pre>\n<\/li>\n<li>I also uncommented the following line from httpd.conf\n<pre lang=\"text\"> \r\nInclude conf\/extra\/httpd-vhosts.conf\r\n<\/pre>\n<\/li>\n<\/ol>\n<p>Blog works fine now. Links yet show https:\/\/www.softwareeverydayblog.com but files are being served from the local box.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress Import\/Export Wordpress allows you to export your &#8216;content&#8217; in xml format. it then allows you to imports that content in a wordpress instance. The tool allows you to import data from various sources (e.g. Live Journal, Tumblr etc). Seems quite straightforward however the wordpress import\/export have some caveats. It requires you to add users [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2468","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2468","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2468"}],"version-history":[{"count":11,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2468\/revisions"}],"predecessor-version":[{"id":2473,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2468\/revisions\/2473"}],"wp:attachment":[{"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.softwareeverydayblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}