disto
08-23-2006, 12:39 PM
hi im creating a 404 error page and i want the url to be displayed.
i did some searching around and found http://www.sitepoint.com/forums/showthread.php?t=6032&goto=nextoldest
i followed this and created the file 404.php
<html>
<body vLink=#ff0000 aLink=#ff0000 link=#ff0000 bgColor=#ffffff>
404 Error
<br><br><font id=text>sorry an error has occoured, we have automatically be notified of this error.
<?php $badurl = "http://" . $SERVER_NAME . $REDIRECT_URL;
$message = "A bad link to $badurl was encountered on $HTTP_REFERER.";
echo $message; ?>
<br><br>
<a href="#" onClick="history.back()">go back</a>
</body>
</html>
using the .htaccess file
ErrorDocument 500 /files/500.html
ErrorDocument 404 /files/404.php
ErrorDocument 401 /files/401.html
ErrorDocument 403 /files/403.html
when the page is displayed it shows
404 Error
sorry an error has occoured, we have automatically be notified of this error. A bad link to http://URL.../files/404.php was encountered on http://URL.../link.html.
go back
so its displaying the URL that contains the error but not which URL the link was to. can anyone help? whats wrong with the $REDIRECT_URL
i did some searching around and found http://www.sitepoint.com/forums/showthread.php?t=6032&goto=nextoldest
i followed this and created the file 404.php
<html>
<body vLink=#ff0000 aLink=#ff0000 link=#ff0000 bgColor=#ffffff>
404 Error
<br><br><font id=text>sorry an error has occoured, we have automatically be notified of this error.
<?php $badurl = "http://" . $SERVER_NAME . $REDIRECT_URL;
$message = "A bad link to $badurl was encountered on $HTTP_REFERER.";
echo $message; ?>
<br><br>
<a href="#" onClick="history.back()">go back</a>
</body>
</html>
using the .htaccess file
ErrorDocument 500 /files/500.html
ErrorDocument 404 /files/404.php
ErrorDocument 401 /files/401.html
ErrorDocument 403 /files/403.html
when the page is displayed it shows
404 Error
sorry an error has occoured, we have automatically be notified of this error. A bad link to http://URL.../files/404.php was encountered on http://URL.../link.html.
go back
so its displaying the URL that contains the error but not which URL the link was to. can anyone help? whats wrong with the $REDIRECT_URL