Let's see how to migrate images WordPress when we performed a migration of a blog that is hosted on WordPress.com and we have moved to a private hosting using WordPress.org. In a previous article we saw what were the steps for migrate a WordPress blog subdomain and in another article things to consider migration during migration to keep SEO SEO.
In this article we will see how to give solution to a problem that the tool export / import does not meet with the images.
Normally, in a blog hosted in wordpress WordPress.com saves images on such routes:
But in a blog hosted on a private hosting with WordPress.org we want to eliminate the date and year folders and save them all together, with the final route like this:
This configuration change is made from the administration panel WordPress> Settings> Media where you have to turn off the option that appears as Organize my uploads into folders based on file month and year.
XML export with entries
From our blog we stayed at WordPress.com we will Tools> Export. Here we generate an XML file with entries from our blog. We will receive an email with the link to download the file. This file will contain the urls of images in the format year-month as we have seen and we have to edit prior to import into our blog WordPress.org.
Edit XML file
For editing the XML file we will use Notepad ++. After opening the XML file with our tickets, we replace all urls wordpress.com by our domain, eliminating subfolders date and the new route. To do this we will use the regular expressions.
We opened our XML Notepad ++ and the form Replace we:
We have to make a choice of regular expression for the search to work.
If you look is underlined the groups of regular expressions. I created 3 groups, the first for the year, The second for the monthAnd the third for filename without the extension. In the field we replace with the new one with the url group 3 denoted by $3. Now we just have to reeemplazar everything that we are in the file. We repeat the process for HTTP Y HTTPS since in WordPress.com we can have the images in the XML file in both.
After editing the file, we can import in our blog from Tools> Import. We keep in mind that we must eliminate all Inputs before making the import because otherwise we will fail that already exist. If your server has a very small timeout, you will have to repeat the imported repeatedly until you display a message that you have completely finished.
We may be prompted to install a plugin if it is the first time we use this tool. Once installed we can use it as explained.
Check that everything is correct
Finally, you just have to check that everything is correctly performing searches on our site using the tool Omnisearch putting the chain files.wordpress.com. This tool is available dese Jetpack> Omnisearch or from the top management bar to the right where the magnifying glass appears. It is a very powerful tool that locates anything at all our blog.
And that's it. I hope you have been helpful and I ask only that you share in your social networks. Greetings.