After moving a site to new hosting, not all images are showing in media library

admin2025-06-06  2

I have moved my website to new hosting.

The site was originally in public_html/websites/dcworldholding/newsite on my server, on the new server its in public_html/

Some images are showing but the majority are not, i've tried updating url's and rerferences in the database, and regenerating thumbnails and neither works.

I've also checked the server and the images are definitley there, but when i enter the direct url to the image, it 404's.

any ideas would be helpful

thanks in advance!

I wondered if anyone might have other ideas?

I have moved my website to new hosting.

The site was originally in public_html/websites/dcworldholding/newsite on my server, on the new server its in public_html/

Some images are showing but the majority are not, i've tried updating url's and rerferences in the database, and regenerating thumbnails and neither works.

I've also checked the server and the images are definitley there, but when i enter the direct url to the image, it 404's.

any ideas would be helpful

thanks in advance!

I wondered if anyone might have other ideas?

Share Improve this question asked Oct 29, 2018 at 20:02 reigns1989reigns1989 171 silver badge6 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The issue is that images URLs are stored in the database as a full URL; domain and all.

When you move a site to a new URL, that doesn't update the URLs in the database. So a 'search and replace' process is needed to go through the database and replace your www.olddomain with your www.newdomain .

I usually use the "Better Search and Replace" plugin to do that. It works well (and easy and fast) to take care of the problem. You could also do it manually with MySQL commands, but a plugin is much faster.

A backup of your database before is always a good idea.

Added

You can verify in the generated page code source, or with Developer Tools (usually F12, then look at the Network tab and reload the page; see the URLs that are being requested for the images).

If the images are still 'scr' from the old domain, then that's how the URL is stored in the database. So the Search/Replace is needed.

Look at an existing Media item; you'll see that one of the fields (meta values) is the full URL of the media item. That comes from the database, so a Search/Replace will fix that.

It's possible that it is a caching issue on the phone or device. Restarting the device ought to fix that. But you can tell via Developer Tools, Network (or the page source) the URL being specified for the media item.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749222946a317393.html

最新回复(0)