SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Thread: error 404 page

  1. #1
    SitePoint Zealot amit290's Avatar
    Join Date
    Oct 2001
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question error 404 page

    Hi,

    just wondering how/if its possible to have a 404 page which says

    Missing requested file
    Missing requested file from

    So for example, if page "domain.com/test.html" had a link to "domain.com/test2.html" and it didnt exist i would get an email saying:

    Requested page not found: domain.com/test2.html
    Requested from page: domain.com/test.html

    I can do the email bit. Just dont know what variables get this information.

    Hope you can help

    Thnx in advance.

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You would actually need to try to execute the link and look at the response headers for 404 (e.g. using XML). You can't do it by just looking at the text of the link.
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    you could try this:

    /.htaccess
    Code:
    ErrorDocument 404 /pippo.php
    /pippo.php
    PHP Code:
    <?php
    print "Missing requested file from ".$_SERVER'HTTP_REFERER' ]."<br>";
    print 
    "Missing requested file ".$_SERVER'REQUEST_URI' ]."<br>";
    ?>
    Just customize the pippo.php script to feel your needs using the mail function.



    pippo

    p.s. edited
    As a note I read that IE does not display" 404 pages that are less than an amount of kb.
    I do not remember that exactly though...
    But indipendent of that the pippo.php will always be called and so the mail function inside it will be executed too...
    Last edited by pippo; Nov 13, 2002 at 06:32.
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  4. #4
    SitePoint Evangelist MobileBadBoy's Avatar
    Join Date
    Jun 2002
    Location
    Mobile, Alabama
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by pippo
    As a note I read that IE does not display" 404 pages that are less than an amount of kb.
    Mine's not even 1 KB (about 500 bytes I think) and IE displays it fine.
    Shawn Kerr .com

  5. #5
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MobileBadBoy,
    thanks for the feedback!
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  6. #6
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Uhhhmm,
    I did a search because something on my mind was noising me.
    So I found this:

    The second critical variable is the size of the error page itself, in bytes. A key in the Windows Registry, HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\ErrorThresholds, sets the size threshold for 404 error pages at 512 bytes. If the Web site's 404 error page is larger than 512 bytes, Internet Explorer will display it; if not, it uses its own.
    at
    http://www.zdnet.com/products/storie...9295-3,00.html



    pippo
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  7. #7
    SitePoint Evangelist MobileBadBoy's Avatar
    Join Date
    Jun 2002
    Location
    Mobile, Alabama
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, must be Windows only. My sites run on Linux boxes.

    I looked and mines only about 300 bytes actually. It's just a meta refresh.
    Shawn Kerr .com

  8. #8
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry .htaccess on win ?!

    hi ...

    any idea how to create .htaccess on Win os ?
    can .htaccess work on win the same as linux host ?



    thx.

  9. #9
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi!

    >>can .htaccess work on win the same as linux host ?
    Yes,
    the difference is that under *nix the . means that the file is hidden.

    >>any idea how to create .htaccess on Win os ?
    The first time you could create a file foo.txt and then rename it as .htaccess.
    But I show what I usually do under windoze.
    I go inside httpd.conf and then I set this directive as:
    AccessFileName htaccess.txt
    So I can easily edit it.
    I did that because my win installation is only for test.
    The problem could be when you have to upload the "htaccess" file to server because you should rename it in that case.

    More info about AccessFileName here:
    http://httpd.apache.org/docs/mod/cor...accessfilename



    pippo
    Last edited by pippo; Nov 20, 2002 at 00:53.
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  10. #10
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx alot ...

    the problem on Win os u cann`t give file name just like this .filename !

    i totlay forget the AccessFileName


Bookmarks

Posting Permissions

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