WP HELP NEEDED: Auto 301 redirecting deleted posts?

10 replies
Hello,

Does anyone know of a Wordpress plugin that will automatically set up a 301 redirect (to point to the homepage, for instance) for any post that is deleted?

I have a site which has a lot of syndicated content (as well as a lot of original content, of course), but I'm overhauling it and intend on deleting a lot of these posts in favour of new, 100% unique, original content. However, I'd like to retain the backlinks these soon-to-be-deleted posts received, and channel them (along with any "link-juice" / PageRank) to the homepage.

I'm aware of the "Redirection" Wordpress plugin, but this only sets up 301 redirects for posts whose URLs/permalinks have changed - not those that have been deleted. I know I could manually set up these redirects as I delete the posts, but with hundreds (if not thousands) of them, that'd be a bit of a headache.

Does anyone have any advice or tips/tricks they'd use in this case?

(And for the record, I cannot redirect whole categories or anything like that, since my site's permalink structure doesn't use category names in the URLs - and there are some unique, original posts among them, which I want to leave alone.)
#301 #auto #deleted #needed #posts #redirecting
  • Profile picture of the author marigot
    I am just thinking outloud here so someone else might provide a better solution.

    I was wondering if you could setup a custom 404 page that redirects to the homepage. That way all the "not found" pages (deleted posts) would be caught and then redirected.

    But honestly, I have no idea how that works in terms of passing on link juice.
    {{ DiscussionBoard.errors[3286171].message }}
    • Profile picture of the author DireStraits
      Originally Posted by marigot View Post

      I am just thinking outloud here so someone else might provide a better solution.

      I was wondering if you could setup a custom 404 page that redirects to the homepage. That way all the "not found" pages (deleted posts) would be caught and then redirected.

      But honestly, I have no idea how that works in terms of passing on link juice.

      Thanks for the suggestion, marigot. I have considered this, but unfortunately there's no way to use a 301 and 404 together at the same URL, and removing the 404 error codes from my site completely may have negative consequences.

      The only other way is to retain the 404 and use a HTML-based redirect, but this wouldn't channel the link-juice like a 301 redirect would.

      What I'll probably end up doing is trying to establish (using Webmaster Tools) exactly which pages have backlinks and which don't. I'll make a "short-list" of the ones that have, and manually set up redirects for them, whilst removing and forgetting about the ones which don't have any backlinks at all.

      Not sure how infallible this approach will be, though, as I even don't think Webmaster Tools shows every backlink it knows about, so I'm bound to lose some in the process.

      I think this is going to be a "put off until another day" sort of job, LOL.

      EDIT: Actually, what I may do, alternatively, is keep all that content up, but just "hide it" away, by removing the category links from the sidebar. Then I'll set up new categories for the new content, and populate them with those old posts which are unique/original, so they can still easily be found by those surfing around my site.
      {{ DiscussionBoard.errors[3286214].message }}
  • Profile picture of the author marigot
    Actually I personally would not use the backlinks found in Webmaster Tools. I find that most of my backlinks that I know are out there are not even shown in my account.

    About your "edit", even if you remove the category link to hide those pages, since they are already indexed, they are going to be available to the public. Using the "private" tag on the post instead of public would in fact hide them, but again, it doesn't help you to send the link juice elsewhere.

    I am sure someone will come along with an excellent suggestion. This seems to be a common issue for people redesigning their sites and I think many people use the mod_rewrite to accomplish this. I would help you with that but I can't start from scratch. I can only use examples I see in tutorials and make them fit my purpose.
    {{ DiscussionBoard.errors[3286295].message }}
  • Profile picture of the author Bauser
    Did you find an answer yet? I have the same problem.
    {{ DiscussionBoard.errors[4015682].message }}
  • Profile picture of the author DireStraits
    Hah, what a coincidence ... it was just today, after a long hiatus from working on the site mentioned in the OP, that I got to thinking about this issue again.

    Unfortunately, though, no; I haven't yet found a simple and viable solution to this. Sorry! :p
    {{ DiscussionBoard.errors[4016052].message }}
  • Profile picture of the author SteveJohnson
    How is WP supposed to know the difference between a post you've deleted and one that just doesn't exist and never has?

    You can easily redirect all 'not found' posts if you want to, but I think you're tilting at windmills - the Big G isn't going to heap "link juice" on your index page just because of a bunch of 301s.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[4019771].message }}
  • Profile picture of the author paulpalm
    There are various ways to handle this...

    .htaccess could be your friend here.

    you could set up a redirector to a simple 404 handler that is called on all failed page requests and output a pretty message,

    or in for example php you could...

    <?php header('Location: hxxp://yourdomain.com/index.php', 301); exit; ?>
    and add this to your 404errorhandler file, using this approach means the redirect sends a 301 - IIRC.

    to redirect all traffic to the index page.
    {{ DiscussionBoard.errors[4022519].message }}
    • Profile picture of the author SteveJohnson
      Originally Posted by paulpalm View Post

      There are various ways to handle this...

      .htaccess could be your friend here.

      you could set up a redirector to a simple 404 handler that is called on all failed page requests and output a pretty message,

      or in for example php you could...



      and add this to your 404errorhandler file, using this approach means the redirect sends a 301 - IIRC.

      to redirect all traffic to the index page.
      ---
      PaulP (old/new school engineer)
      Have to be a little careful with PHP header - default behavior on redirects is to send 302, you have to specify 301:
      <?php
      header('Location: hxxp://yourdomain.com/index.php', 301 );
      exit;
      ?>
      Signature

      The 2nd Amendment, 1789 - The Original Homeland Security.

      Gun control means never having to say, "I missed you."

      {{ DiscussionBoard.errors[4033033].message }}
      • Profile picture of the author paulpalm
        Originally Posted by SteveJohnson View Post

        Have to be a little careful with PHP header - default behavior on redirects is to send 302, you have to specify 301:
        Thanks Steve, I edited my post and added the 301 argument.
        {{ DiscussionBoard.errors[4033518].message }}
        • Profile picture of the author Vrindavan
          <?php
          header('Location: hxxp://yourdomain.com/index.php', 301 );
          exit;
          ?>

          Is this code for a 404 page ?
          and where should i upload to ?

          And what is the code for .htaccess file then ?

          Will google ban a site if there are many file location change and
          404 URLs redirect to a custom page ?
          Signature
          {{ DiscussionBoard.errors[4166014].message }}

Trending Topics