1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to redirect all pages to home page in wordpress

Discussion in 'Blogging' started by pethum, Sep 18, 2014.

  1. pethum

    pethum Regular Member

    Joined:
    May 3, 2010
    Messages:
    401
    Likes Received:
    34
    Location:
    SL
    I want to redirect all my wordpress pages, category pages (I got like 10-20K pages) to my home page or even to new domain..How to do this please..Is there any plugin for this? I tried this but didn't work for me.

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

    allroy Registered Member

    Joined:
    Aug 4, 2013
    Messages:
    67
    Likes Received:
    18
    Try this:
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/index.php$
    RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png|css|js)$
    RewriteRule .* /index.php [L,R=302]
     
  3. gorankmedia

    gorankmedia Registered Member

    Joined:
    Oct 9, 2014
    Messages:
    72
    Likes Received:
    2
    Occupation:
    SEO Marketing
    Location:
    Los angeles
    Yes allroy was correct. To redirect all pages to homepage just use the below code
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .? your site url [R=301,L]
    rewriteRule ^/index\\.php$ your site url [R=301,L]