Community Forums › Forums › Archived Forums › General Discussion › Attachment page giving 404 errors
Tagged: 404, attachment, functions.php
- This topic has 5 replies, 2 voices, and was last updated 11 years, 5 months ago by Brad Dalton.
-
AuthorPosts
-
March 20, 2013 at 7:07 am #29671myersbr2Member
I moved to Genesis a few weeks ago and everything now looks and functions well. http://www.stacymakescents.com is the site. The problem I'm having is that for some reason, when I exported my old WordPress to XML and imported into this installation, now many of the images on my older posts are creating 404 errors. They were linked to the attachment page (which I now don't do). I would like to mass redirect anything that goes to an attachment page to the file (image) so all these 404's will go away. I found some code that is supposed to do this (http://www.wpcloudlayer.com/redirecting-the-attachments-page-to-the-attachment-file/) but it doesn't seem to work for Genesis, I'm sure due to its specialized hooks. Any help?
I've already tried disabling all plugins, etc. and that didn't do anything (just wanted to head that suggestion off at the pass).
The only other thing I would know to do is to re-export the files and then re-import them and hope I could get rid of duplicates...I do NOT even want to try that, as it would be a pain and probably wouldn't work.
March 20, 2013 at 7:39 am #29675Brad DaltonParticipantStill got the old site?
Install The WP Migrate DB plugin and configure the new server path and domain so all the url's change properly.
The function for linking images to attachment page or file url are in the wp-admin/options.php files however they shouldn't be edited there.
There must be a plugin for this or some custom code which i will look for but it sounds like the migration wasn't completed correctly.
March 20, 2013 at 7:53 am #29678myersbr2MemberThanks, Brad, for some input.
Let me make sure I get this right - Log in to the old site, install the WP Migrate DB plugin and use it to export everything. That's now done and I have the sql database saved on my local machine.
Now what? I'm afraid to try to import that into the new WP install because I've got several new posts and comments since the transition on 3/9, so I'm wondering what happens if I try to import the database (and sadly, I'm not even sure how since I'm a total rookie with databases)? Won't it overwrite the new tags/categories/posts, etc., etc. I've created?
March 20, 2013 at 9:07 am #29704Brad DaltonParticipantCreate a new database using the database wizard in cPanel and import the sql file there.
You can then change the wp-config connection details using the new db details. If this doesn't fix broken image url's you'll need to use another solution
There's multiple ways to link your images to the post url or file url rather than attachment post which WordPress generates for all single images uploaded to a post or page. Writing about that at the moment.
The function included in WordPress SEO by Yoast is the easiest: Redirect Image Attachment URLs to Parent Post
March 20, 2013 at 12:54 pm #29757myersbr2MemberThanks, Brad. I'm going to try the Yoast SEO option to see if I can get that to work for me.
March 20, 2013 at 1:19 pm #29767Brad DaltonParticipantYes because that also redirects existing image attachment page URLs to the parent post.
I thought you may have a problem caused by the migration which broke your image links but seems that's not the case.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.