The import/export feature of WordPress is excellent. The issue is when you choose to import the images/media files and it needs to download them from your old WordPress site. You won’t have an issue if your old and your new site use different domain names (ie. oldblog.fuelip.com and newblog.fuelip.com).
However, if you’re like me and you just want to move from blog.fuelip.com to another server whilst still maintaining blog.fuelip.com then it’s a little more work. You’ll probably find that images may not display properly because WordPress embeds the full path of the image when it’s being uploaded.
Please note that I am writing this blog which details a method I used to get my site across. There may be alternative ways/easier ways, but this worked for me and I thought I’d share it.
This is how I did it.
- Windows PC
- Ability to modify DNS records on the linux server or a DNS server
Setup your new blog and have your old blog up and running.
For arguements sake, let’s say:
blog.fuelip.com -> 192.168.1.100
new wordpress -> 192.168.1.200
Now use the export feature to export your current blog to an XML file. This does not export the images. Images are pulled from the old site automatically (it’s an option) when you use the Import Feature.
Here’s the tricky bit.
Edit the host file on your Windows PC so that blog.fuelip.com points to 192.168.1.200 (which is the new site). This means that on your PC only, blog.fuelip.com will point to the new/empty blog site.
On the new WordPress server, the DNS should point to a DNS server you have access to. This should still be pointing to the OLD WordPress server ie. blog.fuelip.com still points to 192.168.1.100
So let’s recap, we have got a Windows PC that thinks blog.fuelip.com points to 192.168.1.200 which is the NEW WordPress server. The actual server hosting the new WordPress application thinks blog.fuelip.com points to 192.168.1.100 which is the OLD WordPress server.
Not on the Windows PC, lets use the Import feature and import the XML file we saved earlier. Make sure you choose to download images/media. Also make sure the users are setup the way you want. Then hit Import.
You should find that the whole site is imported perfectly.
Why does this work?
- The references for the images are based on the URL that is shown whilst you’re browsing the site on the Windows PC (host file makes DNS point to the new site)
- The downloading of the images from the old site is handled behind the scenes by the actual WordPress server which is looking at a different site due to the DNS change.
Hope this is not too confusing…