Home  › Media › Publishing

The Fine Art of Redirection

  |  July 7, 2000   |  Comments

Ever wonder how much traffic you're losing simply because people are clicking on outdated URLs to your site? Well, there's an easy way to find out if your hosting service gives you traffic reports listing the number of 404 errors. Richard tells you how to find the right file in the Error Log and then redirect people to the right page on your site. Never lose a web site visitor due to a bad link again.

Ever wonder how much traffic you're losing simply because people are clicking on outdated URLs to your site? Well, there's an easy way to find out if your hosting service gives you access to the directory where your raw log data is stored.

There's usually a file in there called the Error Log. Every time your web server encounters an error, it writes what the error was in this log. Now the thing you need to be looking for is a statement that says: "File does not exist:" followed by the path to the file that doesn't exist.

These errors show up in your main log file, too. They are called 404 errors, and they look like this:

cache-rc09.proxy.aol.com - - [10/Jun/2000:19:05:34 +0000] "GET /somefile.html HTTP/1.0" 404 8733 "-" "Mozilla/4.0 (compatible; MSIE 5.0; MSNIA; AOL 5.0; Windows 98; DigExt)"

The 404 (in bold) is the transaction code for "file not found." If your hosting service gives you traffic reports, the number of 404 errors is usually included in that report.

OK, so you're getting a lot of 404 errors. How can you fix the situation? Well, you could try to find all those bad links out there on other people's sites and then write those people a nice email begging them to correct the URL. But the chance that they'll do it or that you'll even catch all of the bad links is just slightly less than Hell freezing over. So it is best to take matters in your own hands and correct the problem on your end. And you do that, in geek parlance, by editing your "dot htaccess" file.

Your "dot htaccess" file (written as: .htaccess note the period in front of the "h") is a text file in your root directory (the directory where your index.html file is). If it isn't there, you can easily make one. Your .htaccess file basically tells the server: "Hey, server. If a page request comes in that looks like this, do this instead."

OK, this next part is very important, so read it twice: Do not edit your .htaccess file with anything other than a text editor. Let me write that again: DO NOT edit your .htaccess file with anything other than a text editor.

The reason is that the "do this if the page request looks like this" command needs to be on a single line. The downside of word processors is they like to put line breaks in lines of text they think are too long. Text editors, on the contrary, don't. If you upload a .htaccess file that has line breaks within a command line, you'll totally screw your web server to the point where it will crash.

For the Windows folks, a good built-in text editor is Notepad, though I prefer to use a program called UltraEdit. For the Mac folks, BBEdit is a solid text editor.

OK, so let's get to the commands.

If you want to redirect people to a standard message when they try to access a web page that is no longer on your server, put this in:

ErrorDocument 404 http://THE.FILE.YOU.WANT.TO.SEND.THEM.TO

Here's an example from Booklocker.com:

ErrorDocument 404 http://www.booklocker.com/notfound.html

This tells our server: "Hey, if you get a 404 error, send people to http://www.booklocker.com/notfound.html."

On that page I have a message explaining the link they clicked on doesn't work anymore, but here are some ways to find what they were looking for. I include links to our category page, search engine, and main page, and an email address they can write to for help.

The above solution covers bad links you don't know about. But what if you do know the bad URL and have an updated URL you want to send people to? Well, put in this command:

Redirect PATH TO OLD FILE url to new file

Example:

Redirect authors/jmclain2.html http://www.booklocker.com/jmclain.html

This tells the server: "If you get a request for jmclain2.html in the /authors/ directory, pull the page at http://www.booklocker.com/jmclain.html instead."

Remember, make sure individual commands you write to your .htaccess file are each on one line with no line breaks within them. And put your .htaccess file in your root directory.

Follow those two rules, and you'll never lose a web site visitor to a bad link again.

ClickZ Live Chicago Join the Industry's Leading eCommerce & Direct Marketing Experts in Chicago
ClickZ Live Chicago (Nov 3-6) will deliver over 50 sessions across 4 days and 10 individual tracks, including Data-Driven Marketing, Social, Mobile, Display, Search and Email. Check out the full agenda and register by Friday, August 29 to take advantage of Super Saver Rates!

ABOUT THE AUTHOR

Richard Hoy

After five years of telling others about how to spend their marketing budget online, Richard Hoy recently left the employ of this influential publication to see if what he's been blabbing with his big fat mouth all these years really works. He is President and Co-founder of Booklocker.com Inc., an alternative to traditional publishing that helps authors realize profits of up to 70 percent of sales by combining electronic publishing with Internet marketing.

COMMENTSCommenting policy

comments powered by Disqus

Get ClickZ Media newsletters delivered right to your inbox. Subscribe today!

COMMENTS

UPCOMING EVENTS

Featured White Papers

BigDoor: The Marketers Guide to Customer Loyalty

The Marketer's Guide to Customer Loyalty
Customer loyalty is imperative to success, but fostering and maintaining loyalty takes a lot of work. This guide is here to help marketers build, execute, and maintain a successful loyalty initiative.

Marin Software: The Multiplier Effect of Integrating Search & Social Advertising

The Multiplier Effect of Integrating Search & Social Advertising
Latest research reveals 68% higher revenue per conversion for marketers who integrate their search & social advertising. In addition to the research results, this whitepaper also outlines 5 strategies and 15 tactics you can use to better integrate your search and social campaigns.

Resources

Jobs

    • Sales Planner
      Sales Planner (Verve ) - New YorkAbout Verve   Verve is the leader in location powered mobile advertising. We manage one of the largest mobile...
    • Systems Analyst/Support
      Systems Analyst/Support (Agora Inc. ) - BaltimoreIRIS (Increased Revenue Intuitive Software ) is proprietary software that helps marketers...
    • Client Services Support Specialist
      Client Services Support Specialist (Agora Inc. ) - Delray Beach OVERVIEW:  This position requires a highly motivated and resourceful individual...