For several years I used a WordPress plugin called PhotoPress that was GUI to upload and place images in WordPress posts. The plugin was discontinued in 2007 as WordPress’s own Media gallery greatly improved.
The trouble that I now have is that four or five years worth of images in my posts were uploaded using PhotoPress which attached the images to posts in a particular way that is different from the native WordPress default.
When I switched to a new theme recently it caused a number of problems.
Looking at Google Webmastertools I have over 4000+ 404 errors due to bad links from this situation. (See URLs below)
Although images show up in the posts, if you click directly on any of the images in the older posts, instead of going to a page showing the image, it returns a 404 error. Please see the following:
The images appear correctly inside the post:
However, clicking on an individual image returns a 404 error.
The way that PhotoPress linked the image looks like this: /?pagename=album&?pp_album=main&pp_cat=default&pp_image=zombie_boy_tattoo_lady_gaga_rick_genest.jpg
Meanwhile, the directory path where the image source is actually stored is here:
http://www.hongkonghustle.com/wp-content/photos/zombie_boy_tattoo_lady_gaga_rick_genest.jpg
I’m not certain, but I think this is because the images are not linked to the source file directly – instead they are linked to the POST ATTACHMENT link.
I am very confused about how to fix this.
The images were originally (and still are) stored in wp-content/photos folder, so if you click the direct URL it works.
BUT, when I switched to my new theme, the images did not appear in the Media Library.
So I batch re-uploaded over 4000 images into the Media Library, and they are now sitting there unlinked.
I’m interested in a way of mass re-attaching the source images, and getting rid of the 404 errors.
How would I accomplish this?
Any thoughts? Your advice is greatly appreciated! Thanks!
I ended up doing a 301 redirect in htaccess:
How about doing a 301 permanent redirect on the new theme
index.php
whenever there is app_image
query string?You could redirect
http://www.hongkonghustle.com/?pagename=album&?pp_album=main&pp_cat=default&pp_image=zombie_boy_tattoo_lady_gaga_rick_genest.jpg
to
http://www.hongkonghustle.com/wp-content/photos/zombie_boy_tattoo_lady_gaga_rick_genest.jpg
by appending
$_GET['pp_image']
to http://www.hongkonghustle.com/wp-content/photos/ (content_url()
? )Just make sure that the redirection is done before output is sent, PHP output buffer could come in handy.
Hope that helps.
Possibly useful links: