Cheers esmi.
Maybe i can get your advice on this as well?
The old website had a lot of posts which i’ve imported but all the image links point back to the old site.
Could I use the Safe search and replace script to update the links, but only for the images?
At the moment the image file path looks like this:
http://olddomain.com/files/2013/02/image.jpg
and it needs to look like this:
http://newdomain.com/scarlett/wp-content/uploads/2013/02/image.jpg
Would replacing ‘http://olddomain.com/files’ with ‘http://newdomain.com/scarlett/wp-content/uploads’ work?
The old website had a lot of posts which i’ve imported but all the image links point back to the old site.
How did you carry out the import? Using Tools -> Import?
Could I use the Safe search and replace script to update the links, but only for the images?
That should work.
Would replacing ‘http://olddomain.com/files’ with ‘http://newdomain.com/scarlett/wp-content/uploads’ work?
No. All urls are stored in the database – not in any files.
How did you carry out the import? Using Tools -> Import?
Yes
I think what i’m going to do is upload them all via FTP into their respective folders and then do a search and replace in the wp_posts table to update all the links.
Hopefully that’ll do the trick!
When you imported the content, do you also import all media attachments? Only the urls of the imported images are correctly changed as part of the import process.
It was actually a colleague who imported them all so not sure on the specifics.
I’m going to presume not as the images still hold the old urls.
Good to know for future reference though!
As the other site is still live there are still posts being published which i’m having to transfer over now.
Is there an option when I import the xml file to ‘import all media attachments’ or similar to update the link structure?
No. If you repeat the import, you will duplicate previously imported posts & pages.
That’s frustrating.
What’s best then?
Delete all the existing posts and re-import them or only add the posts since I last imported them and change the links in wp_posts?
I’ve only got the posts in one xml file though so separating them could be tricky and time-consuming.
I’m still in the process of uploading the images – there’s so many!
Stop what you are doing, delete all posts and then re-run the import – this time importing all media files.
So when I re-import them it will pull all the images from the current server to the server I am hosting it on now?
It should do, yes. Just to be safe, re-export all of the content from the old site using Tools -> Export and check that “all content” is selected before you begin the export.
Thanks for your help on this.
In the end I tried re-uploading the .xml, this time choosing to import all media files but I think because there was so many it kept timing out.
Instead I imported without media files (which interestingly didn’t duplicate the posts, but just added the missing ones?!), uploaded the media files via ftp and then did a search and replace in the wp_posts table updating all of the image links.
Got there in the end!