How to Redirect 404-errors posts from Old-blog to New-blog?

6 replies
What is the best way you can think of how to redirect 404 errors from posts from my old blog to the same posts in the new blog?

I recently moved my old blog from the subfolder "blog" (http://www.website.com/blog) to the root (http://www.website.com)

However, that exact some subfolder-blog at "http://www.website.com/blog" is still there; and I'll be deleting that entire old subfolder-blog soon to avoid potential duplicate content penalty.

However, here's the situation...I've been building backlinks to each individual post for that old subfolder-blog for awhile so when people find those links and click on them, they will get a 404 error I presume.

For example, when people find this link http://www.website.com/blog/325/postname/ in some blog comments and click on it, they will go to this post at my old site at http://www.website.com/blog, but it won't be there anymore so they will get a 404 error, while that exact post is at http://www.website.com/325/postname/

It's still the same permalink "325/postname/", but it's just the "blog" in the URL that is causing this, if there were some ways the redirect can remove the "blog" in front.

Therefore, what's the best way you can think of to handle this, or any great plugin to recommend?

Any solution greatly appreciated!
#404errors #newblog #oldblog #posts #redirect
  • Profile picture of the author Bill_Z
    You need to do 301 redirects for each link getting a 404. Here is a plugin for it: WordPress › Redirection « WordPress Plugins

    I haven't used it, but it looks pretty good.
    {{ DiscussionBoard.errors[3283235].message }}
    • Profile picture of the author Jason H
      Originally Posted by Bill_Z View Post

      You need to do 301 redirects for each link getting a 404. Here is a plugin for it: WordPress › Redirection « WordPress Plugins

      I haven't used it, but it looks pretty good.
      Maybe I should have emphasize that I will be deleting this old subfolder-blog and everything and the content, so I'm not sure exactly how this would work?
      {{ DiscussionBoard.errors[3283853].message }}
      • Profile picture of the author traceface
        Originally Posted by Jason H View Post

        Maybe I should have emphasize that I will be deleting this old subfolder-blog and everything and the content, so I'm not sure exactly how this would work?
        Jason, the redirect has to come from some place - don't bother with the redirect work and then delete the entire sub-folder. You'll just delete the redirects.

        With most hosting providers you can do a permanent redirect at the sub domain or domain level. And if you use that solution, redirect them to a site map on your new domain so that they easily find the article they thought they were going to.

        You may lose some readers this way, but the only other alternative is to keep the domain with a permanent redirect to individual posts on the new blog.
        {{ DiscussionBoard.errors[3283999].message }}
        • Profile picture of the author Istvan Horvath
          Originally Posted by traceface View Post

          Jason, the redirect has to come from some place - don't bother with the redirect work and then delete the entire sub-folder. You'll just delete the redirects.

          With most hosting providers you can do a permanent redirect at the sub domain or domain level.
          Exactly - so do a domain-level redirect using .htaccess and you CAN delete the old subfolder.

          Which also means the fisrt sentence above doesn't make sense if you apply the domain level redirect.

          I did that in very complicated settings and it worked. The only "price" I ahd to pay to have exact redirect for each posts was to use the same permalink structure in the new blog(s) as in the old blog(s).

          I had 4 blogs on the same domain (example.com):
          3 in subfolders, 1 on a subdomain

          Had to redirect them like this:
          - one subfolder to > newsubdomain.example.com/subfolder
          - 2nd subfolder to > example.com/newsubfolder
          - 3rd subfolder to > another-example.com
          - subdomain to > (the same) another-example.com

          Placed a htaccess file at the root of example.com with the proper rules AND deleted the old 3 subfolders and subdomain!
          Signature

          {{ DiscussionBoard.errors[3284086].message }}
  • Profile picture of the author Roaddog
    If I am reading your post right, a guy in the programming forum helped me out a few day's ago. Click the link and see if this is what you need.

    I did this with 900 links


    here


    courtesy of shinepuppy
    Code:
    ErrorDocument 404 /404.php
    Then, create a 404.php script in your document root that contains whatever you like... maybe something like:

    Code:
    <?php

    header('Location: http://whateverDomain.com');

    ?>
    If you really wanted to get fancy you could put some logic in your 404 script to inspect the $_GET variable and redirect to different URLs based on the file requested.

    Jim
    {{ DiscussionBoard.errors[3283240].message }}
  • Profile picture of the author Jason H
    Thanks for all the suggestion!

    I think I got it now. I thought it should be more technical, and so I made it more complicated than it should be.
    {{ DiscussionBoard.errors[3284781].message }}

Trending Topics