Log in

View Full Version : Error 404


Shazz
10-20-2006, 01:51 AM
Right now mine says


Error 404: NOT FOUND!
Your browser cannot find the document corresponding to the URL you typed in.

I want it to redirect to my home page everytime someone types something in wrong.

For example

http://www.vbulletin.org/zzzzzzzzzzZZZzzzzz

It forwards back to the home page...

Im gussing .htaccess?

G0F0RBR0KE
10-20-2006, 01:56 AM
yes, it must be done in the .htaccess

Shazz
10-20-2006, 01:57 AM
yes, it must be done in the .htaccess
Errm, What would I put in -.-

G0F0RBR0KE
10-20-2006, 02:05 AM
Check below for a better version ;)

---------

Open Notepad and paste this

<HTML>
<HEAD>
<title> 404 Error Page</title>
<META HTTP-EQUIV=REFRESH CONTENT="5;URL=http://www.yoursite.com">
</HEAD>
<BODY>
<p align="center">

<h1>Error 404</h1><br>Page Not Found

<p>
<?php

$ip = getenv ("REMOTE_ADDR");

$requri = getenv ("REQUEST_URI");
$servname = getenv ("SERVER_NAME");
$combine = $ip . " tried to load " . $servname . $requri ;

$httpref = getenv ("HTTP_REFERER");
$httpagent = getenv ("HTTP_USER_AGENT");

$today = date("D M j Y g:i:s a T");

$note = "Wrong url loser!!!" ;

$message = "$today \n
<br>
$combine <br> \n
User Agent = $httpagent \n
<h2> $note </h2>\n
<br> $httpref ";

$message2 = "$today \n
$combine \n
User Agent = $httpagent \n
$note \n
$httpref ";

$to = "error@yoursite.com";
$subject = "yoursite Error Page";
$from = "From: fake@yoursite.com\r\n";

mail($to, $subject, $message2, $from);

echo $message;
?>

</BODY></HTML>

Replace all yoursite with ur domain; if yours don't have a .com, change the .com to whatever ur URL ends with

$to = "error@mysticgaming.net";
$subject = "MysticGaming Error Page";
$from = "From: fake@mysticgaming.net\r\n";

^^^^^^^PREVIEW of MINE^^^^^^^^


save it as .php, make sure it don't end up as 404.php.html

If you don't have .htaccess, simply open notepad (new file) and type this in

ErrorDocument 404 /404.php

and save it as .htaccess; not .htaccess.txt

upload them in ur public_html folder and than test ur site with any URL that doesn't exist

Preview of my sites

http://mysticgaming.net/hotmail.com and http://areapx.org/yahoo.html