Results 1 to 5 of 5

Thread: error page

  1. #1
    Join Date
    Apr 2007
    Posts
    149
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default error page

    hello. well what i want is to know how to create an error page so that everytime people try to access a page that has been deleted, they get this personalized error page instead of just the regular "this page cannot be displayed"

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Actually, I think this is something that can be done nicely with PHP.

    A 404 error will redirect to a single page based on any page not found.

    That won't help much identifying a single file, though.

    Using the information in the $_SERVER array, you can create a nice error page.

    The info that will help, mostly, is in $_SERVER['REQUEST_URI'].

    echo 'We're sorry, but '.$_SERVER['REQUEST_URI'].' was not found.';

    Then you could also split the REQUEST URI for the various parts, such as the filename:
    PHP Code:
    <?php
    $a 
    explode('/',$_SERVER['REQUEST_URI']); //split at the slashes
    $a $a[count($a)-1]; //get the last bit (1 back because arrays start at 0)
    echo $a//now the filename
    ?>
    That should get you started.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Eh, you will have to talk to your server's administrator...some servers allow you to upload your own 404 page.
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  5. #5
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by alexjewell View Post
    Eh, you will have to talk to your server's administrator...some servers allow you to upload your own 404 page.
    anyone can upload a 404 page, but as djr was saying that is not very personal / page specific. I made the same mistake but I believe that djr's solution would work well in this case.

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
  •