Assumoing your server uses PHP4+, you can add the following to your .htaccess file and parse .html docs as PHP
AddType application/x-httpd-php .html
Becareful here though. Any and all .html docs will be parsed as if they are PHP. If you use this technique, I would suggest using the .htm extension for any pages you do not use PHP on.
If you wish to call it without parsing for PHP, you can have your script send a small image to the browser by sending the header first, and then the image.
Header ("Content-type: image/gif");
readfile ("image.gif");
You write the information to your file, then send the header an image to te browser. Assuming the name of the PHP script is counter.php, you would do the following.
<SCRIPT LANGUAGE="javascript">
<!--
var ref = document.referrer
document.write('<IMG SRC="counter.php?referrer='+ref+' BORDER=0>');
//-->
</SCRIPT>
<NOSCRIPT>
<IMG SRC="counter.php?referrer=NO JS" BORDER=0>
</NOSCRIPT>
You may want to check the above syntax to make sure it is correct. But it should get the point across.
Using this technique, $HTTP_REFERER value in PHP wil be the page calling the script, so we have to get the reffering url from JS, and pass it to the script. $refferer wil hold the actual refferring url.
"image.gif" can be any image you wish, but I would use a single pixel gif.
The noscript tag will ensure that any visitor gets ciunted. You won't get a reffering url from those with JS disabled, instead you get "NO JS". This will help determine bookmarkers from those with JS disabled.
I hope this helps. My very first script was a counter just like your making now. I used this very technique.
One other possibility, I am not certain you can do this within your .htaccess file, but I believe you can tell the server to use index.php as your default document. You can do this within the server config file, and I believe you can from within .htaccess, but I donot know the syntax to use.