Page questions: 404, 401, etc.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jonathan
    Senior Member
    • Mar 2004
    • 1229

    #1

    Page questions: 404, 401, etc.

    Hello all, I'm setting up a new site and using a trick from David here,
    and am wondering what the various number codes mean. A 404 page is
    error, but beyond that I'm kinda 404, 401, 403, etc...?

    Basically looking for a general rundown to which I should include on
    my "Error.php" document and what it would be used for. Thanks,
    - J

    EDIT: Also would I apply it same as 404? "ErrorDocument ###" in .htaccess file?
    "How can someone be so distracted yet so focused?"
    - C
  • AndrewT
    Administrator
    • Mar 2004
    • 3657

    #2
    Originally posted by Jonathan
    Hello all, I'm setting up a new site and using a trick from David here,
    and am wondering what the various number codes mean. A 404 page is
    error, but beyond that I'm kinda 404, 401, 403, etc...?

    Basically looking for a general rundown to which I should include on
    my "Error.php" document and what it would be used for. Thanks,
    - J

    EDIT: Also would I apply it same as 404? "ErrorDocument ###" in .htaccess file?

    Comment

    • sdjl
      Senior Member
      • Mar 2004
      • 502

      #3
      The ones i use are 404, 403, 401, 500.
      Get the details from the link that Andrew provided

      Yes, you do just add a new line with the relevant code in place of 404 in my example.

      David
      -----
      Do you fear the obsolescence of the metanarrative apparatus of legitimation?

      Comment

      • Jonathan
        Senior Member
        • Mar 2004
        • 1229

        #4
        Thanks for the link Andrew; one question is, seeing so many 403s and 401s,
        could one simply use "ErrorDocument 403 /error.php?id=403", for example, that
        would cover all 403.# errors mentioned on the link Andrew provided?
        "How can someone be so distracted yet so focused?"
        - C

        Comment

        • Buddha
          Senior Member
          • Mar 2004
          • 825

          #5
          You may also take advantage of these (possible) $_SERVER[] variables:

          REDIRECT_HTTP_ACCEPT=*/*, image/gif, image/x-xbitmap, image/jpeg
          REDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX A.09.05 9000/712)
          REDIRECT_PATH=.:/bin:/usr/local/bin:/etc
          REDIRECT_QUERY_STRING=
          REDIRECT_REMOTE_ADDR=121.345.78.123
          REDIRECT_REMOTE_HOST=ooh.ahhh.com
          REDIRECT_SERVER_NAME=crash.bang.edu
          REDIRECT_SERVER_PORT=80
          REDIRECT_SERVER_SOFTWARE=Apache/0.8.15
          REDIRECT_URL=/cgi-bin/buggy.pl

          from: http://httpd.apache.org/docs/custom-error.html
          You need to check and see if they are available. Their availability dependents on weather you use a external redirect or not. Well AFAIK anyway.
          "Whatcha mean I shouldn't be rude to my clients?! If you want polite then there will be a substantial fee increase." - Buddha

          Comment

          • sdjl
            Senior Member
            • Mar 2004
            • 502

            #6
            Originally posted by Jonathan
            Thanks for the link Andrew; one question is, seeing so many 403s and 401s,
            could one simply use "ErrorDocument 403 /error.php?id=403", for example, that
            would cover all 403.# errors mentioned on the link Andrew provided?
            Yes, it will cover those "sub" 403 errors. Although i'm not too sure that you'll get the .# part to the error so you'll just have to use a generic 403 error.

            David
            -----
            Do you fear the obsolescence of the metanarrative apparatus of legitimation?

            Comment

            • Jonathan
              Senior Member
              • Mar 2004
              • 1229

              #7
              Thanks for the replies all- Budda, LOL that stuff looks like
              voodo to me or ruskie maybe not sure, its like a foreign language

              I'll stick to simple stuff for now
              "How can someone be so distracted yet so focused?"
              - C

              Comment

              • sdjl
                Senior Member
                • Mar 2004
                • 502

                #8
                Those variables are just ways of getting data back to yourself, or your user, about the error. They're not vital for a basic error document.
                The main ones i use are $_SERVER['HTTP_HOST'] and $_SERVER['REQUEST_URI'].

                The HTTP_HOST one i use to get the www.domain.com part of the domain name. (As i use dynamic subdomains, this returns whatever subdomain URL the user requested.)
                I use the REQUEST_URI variable to get the page the user tried to visit. I use REQUEST_URI over PHP_SELF as when you use mod_rewrite to change URL's underneath PHP_SELF will show the actual URL that mod_rewrite is writing to.

                Wow, did i confuse things more!!

                David
                -----
                Do you fear the obsolescence of the metanarrative apparatus of legitimation?

                Comment

                • Buddha
                  Senior Member
                  • Mar 2004
                  • 825

                  #9
                  Originally posted by sdjl
                  Wow, did i confuse things more!!
                  Ooo! Ooo! I want to help too!

                  Could use $_SERVER['REQUEST_URI'] to find a page that might interest the user too for 404's.

                  Say they're looking for: \article\Abit_KV8_Pro.php

                  You could send them to something like \article\404.php or \search.php?q=Abit+KV8+Pro.

                  Think of the possibilities!
                  "Whatcha mean I shouldn't be rude to my clients?! If you want polite then there will be a substantial fee increase." - Buddha

                  Comment

                  • Jonathan
                    Senior Member
                    • Mar 2004
                    • 1229

                    #10
                    Hmm.. so for a 404 I could use say $_SERVER['PHP_SELF'] to get
                    the exact URL (would it give absolute URL even w/ mod_rewrite?) and
                    have a form sitting there ready for the person to simply hit "enter" and send a error report to me?
                    "How can someone be so distracted yet so focused?"
                    - C

                    Comment

                    • sdjl
                      Senior Member
                      • Mar 2004
                      • 502

                      #11
                      $_SERVER['REQUEST_URI'] Would be better jonathan.
                      It gives you all the parameters that were passed to the URL too, which you may, or may not, want to use

                      David
                      -----
                      Do you fear the obsolescence of the metanarrative apparatus of legitimation?

                      Comment

                      Working...