How to view 404NotFound error page in our website?

by Sanju 2009-05-11 15:06:06

404NotFoundError

To view 404NotFound page in our website add the following line into .htaccess file

ErrorDocument 404 /404notfound.php


Once you added the above line into .htaccess file create a page called 404notfound.php with your own content.

You can also send a mail to the admin once the page NOTFOUND displays.

Following are the variables that can be used to fetch the values while sending a mail to admin...

<#echo var="HTTP_REFERER" >
<#echo var="REMOTE_ADDR" >
<#echo var="REQUEST_URI" >
<#echo var="HTTP_HOST" >
<#echo var="HTTP_USER_AGENT" >
<#echo var="REDIRECT_STATUS" >


Example :

<?php
$ref = $_SERVER['HTTP_REFERER'];
$ser = $_SERVER['HTTP_HOST'];
$uri = $_SERVER['REQUEST_URI'];
$message1 = "Fix the following broken link<br><br>URL: <font color='red'>$uri</font><br> Referer: <font color='red'>$ref</font>";
$subject1 = "Broken link";

/* To send HTML mail, you can set the Content-type header. */
$headers1 = "MIME-Version: 1.0";

$headers1 .= "Content-type: text/html; charset=iso-8859-1";

$mailid = "test@hiox.com";
if(isset($ref)) {
@mail($mailid, $subject1, $message1, $headers1);
}
?>



Tagged in:

1349
like
0
dislike
0
mail
flag

You must LOGIN to add comments