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 redirect 404 pages to my home page ?

Discussion in 'Apache' started by poseidon, Oct 17, 2006.

  1. #1
    Hi, I have changed alot of pages in my site and I feels that now serps may give 404 errors so I want all my 404 page to be redirected to my home page immediately. What can be the safest way of doing this ? what should I add in .htaccess ? is it good to have customized 404 page or just diret him to home page?
    SEMrush
    Regards
     
    poseidon, Oct 17, 2006 IP
    SEMrush
  2. pulsa

    pulsa Peon

    Messages:
    66
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this:
    ErrorDocument 404 /
     
    pulsa, Oct 17, 2006 IP
  3. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #3
    I think that should be ErrorDoucment 404 Index. whatever

    You may also want to consider a custom error page where you refer the above to somepage.whatever instead of the index page/home page. This is somewhat more friendly any may help you preserve and deep linked pages.

    See an example at www.my-e-space.com/nosuchpage.html

    On that page you would provide links to the new pages on your site. If you are really organized it could take the form of if you were looking x it is now at Y. I wasn't and this was all I did. :)
     
    Colbyt, Oct 18, 2006 IP
  4. learn_adsense

    learn_adsense Active Member

    Messages:
    347
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    where ? which document I should edit ?
     
    learn_adsense, Oct 18, 2006 IP
  5. pulsa

    pulsa Peon

    Messages:
    66
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes, but the '/' still work.
    That should be placed in a .htaccess file
     
    pulsa, Oct 18, 2006 IP
  6. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #6
    We all assumed you knew more than you do. Sorry about that. There is a file in the first directory of your site, public_html, if you are using cPanel and a couple of the other control panels call it http_docs I think.

    The file name is .htaccess. It controls all the behind the scenes stuff that manages your site. In this case you are telling it that you want to use a custum error page or that you want all errors forwarded to a specific page.

    To do what you first asked about you would add the following line to your .htaccess file:

    ErrorDocument 404 /index.php

    (or index.html, whatever your index page is).

    To use a custom error page as I did in the example in the earlier post you need to create the custom page and redirect to it like this:

    ErrorDocument 404 /404.html

    My custom error page is named 404.html

    Hope we cleared all this up for you.
     
    Colbyt, Oct 19, 2006 IP
  7. www.livesportz.com

    www.livesportz.com Well-Known Member

    Messages:
    280
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #7
    i think better you use .htaccess file .
     
    www.livesportz.com, Mar 8, 2009 IP
  8. AsepN

    AsepN Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #8
    I also facing the same problem. i've been put htaccess "ErrorDocument 404 /index.html" but seems not working, i put it in html folder. where i should put this htacces, in the root folder or html folder ? thank you.
     
    AsepN, Dec 29, 2012 IP