Results 1 to 11 of 11

Thread: 404 to index

  1. #1
    Join Date
    Jun 2004
    Posts
    2,853

    404 to index

    What's the script (html) for redirecting 404'ers to a page?

    It's like meta refresh "index" or something.


    Thanks.

  2. #2
    Join Date
    Dec 2003
    Location
    Vancouver BC, eh?
    Posts
    571
    Opening up your .htaccess file (assuming you are on apache server) you can create a custom 404 doc, with a message and maybe a javascript redirect or just a message:

    ErrorDocument 404 /path_to_error_page/404.html

    I do this but a slight variation by having one error page and using get vars to choose which error message to display:

    ErrorDocument 404 /path_to_error_page/error.php?e=404

    for example. This just keeps the organization of it simpler.

  3. #3
    Join Date
    Oct 2004
    Posts
    1,171
    in your .htaccess:

    ErrorDocument 404 /index.ext

    replace ext with whatever extention your index page is
    www.Yekaroo.com - Your Chinese Radio Online!

  4. #4
    Join Date
    Jun 2005
    Location
    The Netherlands
    Posts
    1
    Originally posted by Diaga
    in your .htaccess:

    ErrorDocument 404 /index.ext

    replace ext with whatever extention your index page is
    Hi, for some reason that doesn't work with mine.

    This what my htaccess looks like:

    [R=301,L]

    ErrorDocument 404 /crap.html
    Crap.html is in the folder that comes before /www

  5. #5
    Join Date
    Jun 2004
    Posts
    2,853
    This is not what i'm looking for.

  6. #6
    Join Date
    Jun 2004
    Location
    Tampa, Fl
    Posts
    442
    Well then, what are you looking for?
    DBLHost.com
    US Based Shared Web Hosting • cPanel+Softaculous • Email Hosting • Domain Names
    https://www.dblhost.com

  7. #7
    Join Date
    Jun 2004
    Posts
    2,853
    It's like meta refresh "index" or something. - It's an html file.

  8. #8
    Join Date
    Oct 2004
    Posts
    1,171
    In the head:

    <meta http-equiv="refresh" content="2;url=http://webhostingtalk.com/">

    the 2 - would be the # of seconds to wait after page load (adjust accordingly)
    the url, self explanatory
    www.Yekaroo.com - Your Chinese Radio Online!

  9. #9
    Join Date
    Dec 2003
    Location
    Vancouver BC, eh?
    Posts
    571
    Originally posted by Camp2Win
    It's like meta refresh "index" or something. - It's an html file.
    I thought you were looking how to create your own 404 error pages. Which could also include the meta refresh.

  10. #10
    Join Date
    Dec 2003
    Location
    Vancouver BC, eh?
    Posts
    571
    Originally posted by Primalsource
    Hi, for some reason that doesn't work with mine.

    This what my htaccess looks like:



    Crap.html is in the folder that comes before /www
    You got your directory structure wrong. /some_path/file.html

    the leading "/" is not "root" in the sense of your home directory account, but in relation to the .htaccess file. So for instance in the /home/user/www/.htaccess if you put a path of /some_path/file.html in the .htaccess file to your new 404 error doc, then you are actually pointing to this file:

    /home/user/www/some_path/file.html

  11. #11
    Join Date
    Jun 2004
    Posts
    2,853
    Originally posted by Diaga
    In the head:

    <meta http-equiv="refresh" content="2;url=http://webhostingtalk.com/">

    the 2 - would be the # of seconds to wait after page load (adjust accordingly)
    the url, self explanatory
    Correct.

    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •