Tag Archives: open notepad

Avoid Loosing Thousands of Dollars From Your website.

By Bruce Hearder

Imagine this scenario.

You've just released a new product onto the web.
You've sent out all the marketing material and you've signed up as many affiliates as possible and sit back, grab your favorite beverage and wait for the dollars to roll in.

You wait, and you wait.. Nothing.. Not a single sale..

You then think "I'll give it another hour and two and see if anything happens then".
You know your affiliates have been promoting your product, you've been getting the emails, but no sales have occurred..

You start to think maybe something is wrong with your site. So you decide to click on a link in one of your affiliates email and you get the dreaded "404 - File not Found error".

Then you suddenly realize that the link you gave all your affiliates was wrong.
You told them to visit yourdomain.com/specialoffer.html but the real location is yourdomain.com/special-offer.html

So you dash into your site with your FTP tool and quickly rename the page to the new name, and within minutes sales start coming in..

Phew.. But how many lost sales? How many thousands of dollars have you just lost??

It freighting, and it can happen so easily..

Wouldn't it have be good to have some sort of safe guard in place, that sent you an email when the error first occurred with the very first visitor.

Well, there is such a tool. Im going to show you how to implement it for FREE and very easy to setup.

To make this work we need to modify our sites .htaccess file (this file lives in the root directory of your hosting account).

If you don't have a .htaccess simply make one using notepad
(For more information on this see http://websitesecrets101.com/3/creating-a-custom-404-error-page/ )

Then add the following line to bottom of the file.

ErrorDocument 404 /404error.php

Save the file and update your server.

Now we need to make the 404error.php file..

Simply open Notepad on your PC and paste in the following code :

< ?PHP
$email = "you@yourisp.com";
$url = $host.$_SERVER["REQUEST_URI"];
$referrer = trim($_SERVER["HTTP_REFERER"]);
if ($url != 'favico.ico' and $url != 'robots.txt')
if ($referrer == '')
   $referrer = 'An Unknown source OR someone who directly keyed in the link';
$subject = '404 Error on '.$host;
$message = 'Hi
A visitor from '.$referrer.' tried unsuccessfully to  access '.$url.' You may want to try and fix this error';
$headers = 'MIME-Version: 1.0'."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= 'From: 404 Watcher'."\r\n";
header("HTTP/1.1 404 Not Found");
header('Location: '.$host);

Make sure that you change the line that starts with $email to have your email address. No one on the web will see that email address.
It is the address that you want all the errors sent to.

Save the file and copy 404error.php file up to your web site's root document.

Now try it out. Try typing in a filename that does not exist like yourdomain.com/garbage.html and see what happens.

The user will get redirected to the home page of the site and an email containing the error message will be sent to you.

Its now up to you to fix any errors that might occur and saves yourself thousands of lost dollars in lost sales..


Bruce Hearder owns and run http://www.WebsiteSecrets101.com

Sign up for the WebSiteSecrets101 newsletter, and learn the tricks webmasters use on their sites.