Image URLs in XML export file

  • Unknown's avatar

    I’m struggling to understand why the media (image) URL links in an xml export file from my site have a format https://www.mysite.net/blog/wp-content/uploads/bacchus-1.jpg wheras the media library images correctly have the URLs without the sub-directory “/blog”.

    This is making my export useless as the images are replaced by “x” placeholders.

    What am I doing wrong ?!!!

  • Unknown's avatar

    The reason your export file contains the /blog subdirectory is that WordPress stores image links as absolute paths in your post content, meaning it literally writes the full URL into the database. If your site was ever hosted in a /blog subfolder, those old URLs remain in your posts even if you’ve moved the site to the root directory since then. To fix this and make your export useful, you don’t need to manually edit the XML; instead, use a plugin like Better Search Replace on your live site. Search for mysite.net/blog/wp-content/uploads/ and replace it with mysite.net/wp-content/uploads/. This will update every post on your site to match your current Media Library structure. Once that’s done, generate a new XML export, and the ‘x’ placeholders will disappear because the URLs will finally point to the correct, existing image locations.

  • Unknown's avatar

    Many thanks for your help.

  • Unknown's avatar

    You are very welcome! I’m glad I could get that sorted out for you. If you run into any other snags with your images or the ‘Search and Replace’ process, don’t hesitate to reach back out. Happy blogging!

Log in or create an account to reply