How to redirect all pages to home page

Discussion in 'WordPress' started by madusanka, Sep 15, 2014.

  1. #1
    I need to redirect all my wordpress pages, category pages(I got like 10-20K pages) to redirect to my home page..How to do this please..Is there any plugin to do this?
     
    madusanka, Sep 15, 2014 IP
  2. themes4all

    themes4all Well-Known Member

    Messages:
    662
    Likes Received:
    47
    Best Answers:
    6
    Trophy Points:
    100
    #2
    Hello,
    Keep in mind that Redirecting all Pages to Homepage will Effect your SEO and Links Juice...
    If you are sure about what you want to do.. you can use Htaccess :

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !=/index.php
    RewriteRule .* /index.php

    Goodluck
     
    themes4all, Sep 16, 2014 IP
  3. www_HypeFree_com

    www_HypeFree_com Active Member

    Messages:
    218
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    65
    #3
    You might be better off just putting a banner on top of each page saying something in bright red:

    FOR THIS REASON CLICK HERE TO BE TAKEN TO THE HOME PAGE...

    then the SEO link juice will not be destroyed and people can still click and go there.
     
    www_HypeFree_com, Sep 16, 2014 IP
  4. madusanka

    madusanka Active Member

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    61
    #4
    I tried this but didn't work for me.. And I'm not care about SEO..All I need is to redirect all my pages to home page or even to a new domain.
     
    madusanka, Sep 16, 2014 IP
  5. Mr.Ultra

    Mr.Ultra Member

    Messages:
    50
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    43
    Digital Goods:
    10
    #5
    Just paste following code to your header.php,
    <?php
    if (!is_home() && !is_front_page()) {
    wp_redirect( home_url(), 301 );
    exit;
    }
    ?>
    PHP:
    before </head> tag.
     
    Mr.Ultra, Sep 19, 2014 IP