I want To Redirect All my post under one Category to URL

by Ellero
6 replies
Hi Experts,
I want to redirect my whole post which are in single category to One Single URL.
Eg:
100 Post under Category "a" i want to redirect all of them to one url.
just Like this i have 5 - 8 categories.
Please suggest me the Best plugin or Hack for this .


Thanks in Advance
Regards,
Ellero
#category #post #redirect #url
  • Profile picture of the author unnatural
    Put this code on the top of your post.php page (or whatever page is handling your single posts).

    <?php

    if (is_category( 'your-category-slug-or-id-here' )) {
    header("Location: http://the-url-you-want-to-redirect-to.com");

    }

    ?>
    {{ DiscussionBoard.errors[4788621].message }}
    • Profile picture of the author Ellero
      Thanks But i want to Redirect all post which are under single category to single URL
      {{ DiscussionBoard.errors[4788987].message }}
      • Profile picture of the author unnatural
        Originally Posted by Ellero View Post

        Thanks But i want to Redirect all post which are under single category to single URL
        That's exactly what that code does, just replace the category with your own category id, slug or name and replace the URL that you want to redirect too.
        {{ DiscussionBoard.errors[4791476].message }}
  • Profile picture of the author katsar0v
    I need the id of this category and put it in the code which unnatural gave you
    {{ DiscussionBoard.errors[4789188].message }}
  • Profile picture of the author Istvan Horvath
    I want to redirect my whole post which are in single category to One Single URL.
    Eg:
    100 Post under Category "a" i want to redirect all of them to one url.
    That doesn't make much sense...

    You mean nobody will be able to read any of the 100 posts - because all of them will be redirected to some other URL.

    Then why the heck to have 100 posts?
    Signature

    {{ DiscussionBoard.errors[4792964].message }}
    • Profile picture of the author gtownfunk
      Well, it depends if some of those posts have serious link juice coming in or are getting some real traffic on their own. People will click away if they don't get what they're looking for.. but..

      I have heard of strategies to kickstart google into indexing a new website by redirecting other pages to it (passing on the juice/PR) and then putting everything back to normal.

      It's not always good to kill the URLs, IMHO.

      gtownfunk
      Signature
      {{ DiscussionBoard.errors[4803994].message }}

Trending Topics