Article:
  Custom Error Pages with PHP and Apache
Subject:   I can't get it to work!
Date:   2008-01-01 02:23:52
From:   dawmail333
I can't get it to work?
Here's the code that I use on the error page:

$loc = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : FALSE;
$cod = isset($_SERVER['REDIRECT_STATUS']) ? $_SERVER['REDIRECT_STATUS'] : FALSE;
print($loc);
print(" ");
print($cod);

However, when the page is displayed, it shows the error code correctly, but it prints the url to the error page, not the page they were trying to go to.
This is my .htaccess:

ErrorDocument 404 /err404.php
ErrorDocument 403 /err403.php
ErrorDocument 500 /err500.php



(Linebreak intentional)
Can anyone tell me what is going wrong? Thanks in advance.

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • I can't get it to work!
    2008-01-01 04:44:13  dawmail333 [View]

    Sorry, I fixed it, I needed to change some code:

    $loc = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : FALSE;
    print($loc);

    to:
    print($_SERVER['REQUEST_URI']);