最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

gallery - Images 404 after wp migration to a subdomain

programmeradmin1浏览0评论

Hello guys I have just cloned a website I am having an issue.

In the clone there are just a handful of images that work. All the others appear as broken images in the front-end.

When you try to check the gallery almost all images appear blank (broken). When you try to view the image using it's link .jpg not even the permalink works for example you get an error 404 Not Found but the image is actually there according to the ftp. So someone must be wrong either the FTP or the browser.

I have already edited permissions to be on the safe side for the folders on 755 and files 644.

Also it seems that I can not even upload new images, all appear to be broken as well.

Edited to add the clarification comments

At first I thought of URLs as well so I used Search & Replace. I deleted htaccess and re-saved the permalinks to create a new one. After that I thought it could be that the permissions are set incorrectly so I edited that as well but still the images do not work for some reason. Also I thought that the image files (as some of them work) might be corrupted so I "replaced" the images from the original site (copy/paste).

I have tried everything that I can think of, also if the issue was the image URL then all images wouldn't work but there are a few that do work. For example this one. Also this is a clone website for dev purposes that means that the original website is actually there, had it been a URL issue the images would still appear but using the original website path though. I have used the plesk clone, I know it doesn't work 100%.

Fixed

Alright it seems that the culprit was a plugin. I have several plugins that I wouldn't use in the dev website, cleared cache and all the images popup up like mushrooms. I suppose it was the webp express that did the trick (removing it I mean) but it is only one of the four that I disabled and deleted. The list of the deleted plugins is:

  • cookie notice
  • quick page redirect
  • webp express
  • Yoast SEO

Hello guys I have just cloned a website I am having an issue.

In the clone there are just a handful of images that work. All the others appear as broken images in the front-end.

When you try to check the gallery almost all images appear blank (broken). When you try to view the image using it's link https://tester.medicalfa.gr/test/wp-content/uploads/2019/05/logo-2.jpg not even the permalink works for example you get an error 404 Not Found but the image is actually there according to the ftp. So someone must be wrong either the FTP or the browser.

I have already edited permissions to be on the safe side for the folders on 755 and files 644.

Also it seems that I can not even upload new images, all appear to be broken as well.

Edited to add the clarification comments

At first I thought of URLs as well so I used Search & Replace. I deleted htaccess and re-saved the permalinks to create a new one. After that I thought it could be that the permissions are set incorrectly so I edited that as well but still the images do not work for some reason. Also I thought that the image files (as some of them work) might be corrupted so I "replaced" the images from the original site (copy/paste).

I have tried everything that I can think of, also if the issue was the image URL then all images wouldn't work but there are a few that do work. For example this one. Also this is a clone website for dev purposes that means that the original website is actually there, had it been a URL issue the images would still appear but using the original website path though. I have used the plesk clone, I know it doesn't work 100%.

Fixed

Alright it seems that the culprit was a plugin. I have several plugins that I wouldn't use in the dev website, cleared cache and all the images popup up like mushrooms. I suppose it was the webp express that did the trick (removing it I mean) but it is only one of the four that I disabled and deleted. The list of the deleted plugins is:

  • cookie notice
  • quick page redirect
  • webp express
  • Yoast SEO
Share Improve this question edited May 31, 2019 at 7:50 JohnnyD asked May 30, 2019 at 16:28 JohnnyDJohnnyD 1034 bronze badges 4
  • How did you clone the site? Did you use a database migration plugin so all the old-subdomain URLs are updated? – WebElaine Commented May 30, 2019 at 17:45
  • I used plesk, but already have edited the sql so that the old permalinks are replaced with the new ones. – JohnnyD Commented May 31, 2019 at 5:48
  • Did you search and replace with a plugin, or just go through with something like a text editor? It could be that serialization is getting in your way. Or perhaps there is a CDN, and when you load files through FTP they're not getting copied to the CDN - they can only be copied when you use the Media Uploader? You may want to check to see if your host has specific instructions for cloning, or if they can offer support for your particular case. – WebElaine Commented May 31, 2019 at 14:20
  • 1 I used a plugin titled Search & Replace but to be honest I manually checked the DB afterwards just to be on the safe side. It wasn't a CDN issue the culprit was a plugin but I am not certain which one I have updated the main thread with the bold Fixed to let everyone know that I have managed to fix it. And maybe someone else has the same issue so it might be helpful. – JohnnyD Commented May 31, 2019 at 15:12
Add a comment  | 

1 Answer 1

Reset to default 0

Image URLs are stored within the 'post' entry that is the media item.

So you can change each one manually via the Media screen. Or use a search/replace plugin to do it all at once. I like the "Better Search and Replace" plugin. Just enter the old URL's domain, and the new one. Use the 'test' button to see what it will do. If all is OK, then do it.

Database backups are always good before operations like these. (And a good thing in general.) I've used the above plugin several times without problems.

发布评论

评论列表(0)

  1. 暂无评论