How to 301 redirect 404 pages in wordpress?

Discussion in 'Black Hat SEO' started by jon_xx_x, Mar 10, 2012.

  1. jon_xx_x

    jon_xx_x Jr. VIP Jr. VIP

    Joined:
    Nov 15, 2008
    Messages:
    3,243
    Likes Received:
    1,498
    Can someone tell me code to use so I can 301 404 pages (expired aged domain links), to the main domain?
    I usually use a plugin but it's giving me site errors.
     
  2. whosays

    whosays Newbie

    Joined:
    Jul 25, 2011
    Messages:
    33
    Likes Received:
    9
    Doing a quick search the plugin '404 redirected' may be of use
     
  3. jon_xx_x

    jon_xx_x Jr. VIP Jr. VIP

    Joined:
    Nov 15, 2008
    Messages:
    3,243
    Likes Received:
    1,498
    Thanks, I'll try it. Hopefully it works on my host.
     
  4. [Bender]

    [Bender] Registered Member

    Joined:
    Feb 1, 2012
    Messages:
    67
    Likes Received:
    48
    put this in .htaccess (in root folder) and save

    redirect 301 /old/old.htm <newlink>

    but yea, that's a 10-15 seconds of google question.. i would have posted the link but I can't :)
     
  5. whosays

    whosays Newbie

    Joined:
    Jul 25, 2011
    Messages:
    33
    Likes Received:
    9
    Found this also. Says to put in the themes 404.php file. If there is not one, create the 404.php within the theme directory

    Code:
    //Simple Redirect for WordPress.
     //Christopher Carey
     //301 Redirect for WordPress
     
     header("HTTP/1.1 301 Moved Permanently");
     header("Location: ".get_bloginfo('url'));
     exit();
    
     
  6. allinet

    allinet Registered Member

    Joined:
    Mar 28, 2011
    Messages:
    91
    Likes Received:
    22
    Occupation:
    Computer and Laptop Service Specialist
    Location:
    Lockport, IL
    Home Page:
    add a line(s) to the .htaccess on the root of the domain

    redirect 301 /expired link/ http://www.domainDOT.whatever
     
  7. Shadeofblack

    Shadeofblack Jr. VIP Jr. VIP

    Joined:
    Dec 26, 2011
    Messages:
    294
    Likes Received:
    61
    Occupation:
    Internet Marketer
    Location:
    Brisbane, Australia
    If your using wordpress I use a plugin called "404 to start".

    Hope this helps
     
  8. jon_xx_x

    jon_xx_x Jr. VIP Jr. VIP

    Joined:
    Nov 15, 2008
    Messages:
    3,243
    Likes Received:
    1,498
    Thanks. I think I found what my original problem was though, I didn't add a page, so I was getting a 404 error, so it was looping.
     
  9. kvmcable

    kvmcable Supreme Member

    Joined:
    Dec 28, 2010
    Messages:
    1,354
    Likes Received:
    2,820
    Occupation:
    24 year business owner - old school dude
    Location:
    KFC - BW3
  10. jon_xx_x

    jon_xx_x Jr. VIP Jr. VIP

    Joined:
    Nov 15, 2008
    Messages:
    3,243
    Likes Received:
    1,498
    That's the one I always use.
    I don't know what the problem was, but it seems to be working now.