Importing large WordPress Blog from one server to another

If you find this free website useful – why don’t you support this with a donation? It is easy…. read more ….

I am writing this post as I have learned that moving a big blog from one server to another can be difficult.

As most movements I have are from a stand alone WordPress site to a Multi-Site, I find the export / import the easiest way, but it isn’t without issues.

The Export/Import method is describe well  here on wpmudev here so I won’t repeat it.

If I’m just moving a WordPress single site to another host on the same domain, then the easiest way if to backup and restore, and if you have c-panel on your hosting this is really easy.  WordPress have some information on their codex here,   but it isn’t easy. Sometime you don’t have cpanel access or server access, so the import technique can be used by setting up an empty WordPress install on your new server.

Back to Export/Import method, this works fine, IF the blog / site isn’t too big. You start to run into trouble when the site is large, and especially if you want to import media, and the other host is slow, as you get timeouts.  Even where I have control over all my own server settings, moving 2gb of media from a GoDaddy site will result in failures.

The solution to this is DO NOT tick the import media box.

p.s. if you have difficulty importing the xml file WITHOUT media, and can’t get you PHP setting  sorted you can split the xml import file, and this tool does the job WordPress WXR File Splitter (RSS XML).

If you don’t import media, your site will still LOOK like it is OK as the post will all point to the urls on the remote server. Obviously that will become a problem when you turn the old site off.

But there is a great plugin ‘Image Teleporter‘  that literally brings onboard all the images and updates the links in your posts, even has a batch mode in case timeouts are an image, simple to use. Job done!

Well nearly. In a recent transfer, somehow (maybe from older versions of  WordPress, maybe cause it was on a windows host – don’t know)  that a good thousand images had special characters in the filenames, that broke WordPress Media Library and presented broken images.

The solution to this is a bit more tricky.

Step 1

Install the plugin ‘Media File Renamer‘  , another great little plugin, you can set your file name to your  image title.  I think the idea is really for SEO, but this way the filename get cleaned up and ‘unbroken’.

There is a batch mode that will change all filenames that don’t match titles.

Step 2

If however you have over 1,000 images that have empty titles and need titles for the plugin to work, that is a lot of typing to create a load of unique titles.

Step 3

However, a little bit of database manipulation and you can generate titles for all the missing ones. You may need to alter this code to suit your own requirements (always back p your database, and no liability accepted here). This code for instance will add a RANDOM title to all posts that have jpeg files and no existing title on multisite blog 134.

update `wp_134_posts`
set post_title = concat(
char(round(rand()*25)+97),
char(round(rand()*25)+97),
char(round(rand()*25)+97),
char(round(rand()*25)+97),
char(round(rand()*25)+97),
char(round(rand()*25)+97),
char(round(rand()*25)+97),
char(round(rand()*25)+97)
)
where
`post_title` = ''
and
post_type = 'attachment'
and
post_mime_tpe ='image/jpeg'


Posted

in

,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *