BigNoseBird.Com- Home Small Logo
The 508 Compliant Guide to 
       Big Nose Bird

Creating A Real BACK Button
Server Side Includes!

I don't know where you came from

How did you do that?
One of the more perplexing links on a web page is the back button or link. Just as with any point on a spider's web, a reader could have wandered to any of your pages from possibly several pages on your site, external links, and of course search engine results.

The Apache Environment variable, HTTP_REFERER is used above to show you the full URL of the page that brought you here. In the example above, Extended SSI (XSSI) logic was used to see if there was a value in the HTTP_REFERER variable. This allows you to handle situations such as bookmarks or browsers that do not report a value for the HTTP_REFERER. Let's look at the source code:

  <!--#if expr="${HTTP_REFERER} =/http/" -->
     <B>You came from <!--#echo var="HTTP_REFERER"--></B>
    <!--#else -->
      <B>I don't know where you came from</B>
  <!--#endif -->
The if statement basically says, "If the HTTP_REFERRER contains an expected value, such as http which is in all URL's, create a link, otherwise print a message indicating a problem."

I don't have XSSI, Can I still have a back button?
Of course. With any SSI compatible server you can simply do this:

   <A HREF="<!--#echo var="HTTP_REFERER"-->">BACK</A>

How do I keep people on my site?
This is a tad sneaky, but if you want to keep readers on your site, you can do what Andrew Jones sent in. XSSI is required.

  <!--#if expr="${HTTP_REFERER} =/bignosebird/" -->
    Return to <A HREF="<!--#echo var="HTTP_REFERER"-->">previous
      <!--#else -->
    Return to <A HREF="">front page</A>
  <!--#endif -->
What this code is doing is checking to see if the value "bignosebird" is contained in the HTTP_REFERER. If so, give the reader a link that takes them back to the referring page, otherwise (assuming they came from off-site) take them to our home page!

If you are curious, at BNB we just use the back button to take you to the page the tutorial is listed on. This way I bring my reader to the place containing the most related information to what they might be looking for.


Find or Give Help on the BBS
Home Top E-Mail
If it looks great, it's by Christine
Some Fine Print
© 1997-2003 BigNoseBird.Com®, Inc. All rights reserved. All other trademarks are the sole property of their respective owners. The products that we recommend are only ones that we use. We have no relationship with any of the authors or their companies. We cannot assume responsibility for their ultimate performance or lack of same. We also cannot assume responsibility for either any programs provided here, or for any advice that is given since we have no control over what happens after our code or words leave this site. Always use prudent judgment in implementing any program- and always make a backup first! For further information, please read our Privacy Statement. We can be contacted at

Web Builder Network Portal
on the
BigNoseBird Newsletter

Sign up today to receive our low volume newsletter. Tips, tricks, news, and whatever else crosses our minds.
Back Issues
Privacy Statement