Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2002
    Cube Galaxy HQ

    Error Redirections

    I'm not sure if this is the right forum for this question, just because I don't know if the answer has to do w/ programming or not. Either way, here goes.

    I've seen sites where, if you get an error, it comes up with the site's layout enclosing the error. For instance, if you got an 404 error, it would say something like "HTTP 404 Error" inside the text area of that sites layout.

    How would one do this?

  2. #2
    in root of your site put 404.shtml file.
    We value support and network performance.

  3. #3
    Join Date
    Apr 2002
    Cube Galaxy HQ
    Does the same go for errors with different numbers?

    Can I make it 404.php?

  4. #4
    1. yes.
    2. IMHO no. at least with general apache setup.
    We value support and network performance.

  5. #5
    Join Date
    Apr 2002
    Cube Galaxy HQ
    OK, just wondering b/c of the O in IMHO, does anyone else know?

    rhymes too

  6. #6

    the easiest way is using the ErrorDocument directive in apache =]

    other than that, you could use ssi to execute a php script (albeit its tricky).
    ssi cant execute php directly, but you could do any of those:
    redirect the user to 404.php
    execute the php cgi binary through ssi
    anything else you can think of

    good luck,
    * Rusko Enterprises LLC - Upgrade to 100% uptime today!
    * Premium NYC collocation and custom dedicated servers
    call 1-877-MY-RUSKO or paul [at]

    dedicated servers, collocation, load balanced and high availability clusters

  7. #7
    I tried to include PHP in shtml but shtml just gets the source script, not good when your using includes and database to power a site.

  8. #8
    Join Date
    Sep 2002
    Phoenix area
    which do you have; apache, webstar, IIS, etc?
    Learn survival/prepper information from a combat veteran at Graywolf Survival

  9. #9
    Join Date
    Sep 2002
    Phoenix area
    If you're using apache,

    edit a file called .htaccess in the root directory of your web and enter your error handlers in the following format, one per line (404 is just one of many error handlers, here is a larger list of them):

    Error #204
    No response from server.
    Error #400
    Bad request.
    Error #401
    Authentication required.
    Error #404
    URL not found.
    Error #500
    Server errors. Similar to error 204.

    Client Errors: An error occurring due to an invalid request by the visitor's browser. Possible errors include:

    400 Bad Request: The request could not be understood by the server due to malformed syntax.

    401 Unauthorized: The request required user authorization or the authorization was refused.

    403 Forbidden: The server understood the request, but the server refused to fulfill it.

    404 Not Found: The server did not find anything matching the request by the client. The page possibly does not exist.

    Return Code: The return status of the request which specifies whether the transfer was successful.

    Possible "Success" codes are:

    200 = Success: OK

    201 = Success: Created

    202 = Success: Accepted

    203 = Success: Partial Information

    204 = Success: No Response

    300 = Success: Redirected

    301 = Success: Moved

    302 = Success: Found

    303 = Success: New Method

    304 = Success: Not Modified

    Possible "Failed" codes are:

    400 = Failed: Bad Request

    401 = Failed: Unauthorized

    402 = Failed: Payment Required

    403 = Failed: Forbidden

    404 = Failed: Not Found

    500 = Failed: Internal Error

    501 = Failed: Not Implemented

    502 = Failed: Overloaded Temporarily

    503 = Failed: Gateway Timeout

    Server Errors: An error occurring at the server. Possible errors include:

    500 Internal Server Error: The server encountered an unexpected condition preventing it from fulfilling the request.

    501 Not Implemented: The server is not capable of supporting the request.

    502 Bad Gateway: The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.

    503 Service Unavailable: The server was unable to handle the request due to temporary overloading.


    In .htaccess, you write:
    ErrorDocument [3-digit code] [/path/errorpage]
    For example, you can point to a custom 404 page like this in .htaccess:
    ErrorDocument 404 /errors/custom404.html

    You just have to have a page in /errors called custom404.html for .htaccess to reach

    if you don't have a .htaccess, you can create something like htaccess.txt , ftp it to the web, and rename it to .htaccess (windows doesn't like .htaccess)

    you can also do this in your httpd.conf file in apache, but you probably shouldn't.
    Learn survival/prepper information from a combat veteran at Graywolf Survival

Posting Permissions

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