1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to f@ckin 404 redirect to main page in wordpress

Discussion in 'WordPress' started by pary07, Oct 4, 2008.

  1. enclave

    enclave Peon

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #21
    this will work reliably. I would suggest that directing people to a non-homepage though.

    Why? get some better / higher converting content to rank / get traffic ;-)
    SEMrush
     
    enclave, Nov 1, 2010 IP
    SEMrush
  2. piwacket

    piwacket Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #22
    enclave, thanks!

    Are you saying that should be the content of the 404.php error page? Problem is, I've since found, that it's not accessing this page at all. I don't know why. I THOUGHT wordpress used that file if it existed automatically. That does not seem to be the case. I don't want to "succumb" to the plug-in solution until I understand this fully. So, were you talking about the 404.php file having that content? Also, is it or should it be necessary that I reference that file in .htaccess? (I THOUGHT WP handled this "automagically". : ) Or, if not, then it's based on how the theme is configured by the theme writer? (and if so WHERE/how?).

    Now, regarding your comment about getting better/higher content ranking by not going directly to the front page... really? how so? I don't understand why/how that would work? Please explain. My content is "time sensitive" so the freshest content (and it's updated nearly every day) ... ads appear on every page... so my setup is probably not your typical one.

    Thanks again for your response, enclave...

    Anyone is invited to add their two-bucks here (formerly "two-cents" but you know, the economy and all...:rolleyes: :)


     
    piwacket, Nov 2, 2010 IP
  3. WiroWaas

    WiroWaas Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #23
    Edit your 404.php with and put the following code
    <?php wp_redirect(get_option('siteurl'),301); ?>
    PHP:
     
    WiroWaas, Nov 6, 2010 IP
  4. piwacket

    piwacket Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #24
    Thanks WiroWaas... did that. It didn't work... again... for some reason I'm not hitting that file... I can prove that because I put google.com in as the site url and it didn't go there.

    I appreciate you trying to help though. It may be a config problem with wordpress/plesk... What I need to know is if wordpress automaticaly uses a 404.php file if it encounters it within the same directory as the theme's php pages, or if you have to HOOK it somehow when you create a theme. I'm using a theme called "unknown" (yeah, try searching for that!!!) and I don't know if it came originally with a 404.php page or not. but if I can determine how wordpress deals with this. or how a theme builder should deal with it, then I'd understand a little bit more.

    Thanks again, for your help.
    Pi
     
    piwacket, Nov 6, 2010 IP
  5. trajeshwar

    trajeshwar Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #25
    <?php
    header("Status: 301 Moved Permanently");
    header("Location:http://url");
    ?>

    this worked for me. try it
     
    trajeshwar, Dec 30, 2010 IP
  6. smsinhindi

    smsinhindi Peon

    Messages:
    561
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #26
    1st sorry to bring this old post back.
    But after a lots of search I found it and it solved my problem. After migrating from blogger to wordpress, I have many hundreds 404 error and it just solved all it easily.

    thanks you
     
    smsinhindi, Jul 12, 2011 IP