Hotlinking Pages
AWStats provides a standard list of referrers. This list includes normal referrers, as well as pages with direct “hot” links to your images, movies and other multimedia contents. For some sites, it is important to trace the hot linking pages.
This is what we do with this Extra Section. You can add it at the end of your awstats.your-domain-name.conf configuration file.
New Report
This AWStats screen has been simulated for better readability.
Extra Section
ExtraSectionName1="Hotlinking pages"
ExtraSectionCodeFilter1="200 304"
ExtraSectionCondition1="URL,\.mpeg$"
ExtraSectionFirstColumnTitle1="Referrer"
ExtraSectionFirstColumnValues1="REFERER,^(?!http:\/\/www.your_site.com)http:\/\/(.*)$"
ExtraSectionFirstColumnFormat1="<A HREF='http://%s' TARGET='_blank'>%s</A>"
ExtraSectionStatTypes1=HBL
ExtraSectionAddSumRow1=1
MaxNbOfExtra1=25
MinHitExtra1=1
Replace www.your_site.com by the address of your site.
MaxNbOfExtra1 is the number of lines that will be listed. Use the most convenient value.
Further Technical Details
To find hotlinking pages to different types of files, use || (AWStats logical OR) to separate the conditions.
The edited ExtraSectionCondition will look like this :
ExtraSectionCondition1="URL,\.mpeg$||URL,\.mpg$||URL,\.avi$"
To exclude the addresses of pages in Google cache from the list of hotlinking pages, we use the | (logical OR within regular expressions).
The modified ExtraSectionFirstColumnValues looks like this:
ExtraSectionFirstColumnValues1="REFERER,^(?!http:\/\/www.your_site.com|http:\/\/\d+\.\d+\.\d+\.\d+\/search\?q\=cache\:)http:\/\/(.*)$"
May 16th, 2007 at 12:04 pm
Hi, Great piece of code there, it is really useful to me Thanks. Is there a way of limiting the length of the reported url, or wrapping, because it is making the page width 3x the width of the screen. Thanks again. Tim.
May 16th, 2007 at 9:12 pm
Hi Tim,
Thanks for your comments. Try this to limit the length to 80 characters:
ExtraSectionFirstColumnFormat1="<A HREF='http://%s' TARGET='_blank'>%.80s</A>"
January 11th, 2008 at 6:38 am
Thanks for the tips Jean-Luc!
I already find awstats to be heaps for me (being a novice) but I can see how it would be handy for more technical users.
January 20th, 2008 at 5:11 pm
How to hide a referer spam in AWStats?
April 12th, 2008 at 7:12 am
Hi Great code. i used this piece of code to see the list of sites who hotlink images of my site. but there are mail referrers as well. i.e. people hotlink images in the emails. i want to exclude all those addresses which contain *mail.* in it as part of the domain/subdomain. it ll remove the referrers from the 3 big email providers yahoo, gmail, hotmail as they use the url of king mail.yahoo.*, mail.google.com/* and mail.live.com/*
i am not familiar with regex. can u tell me how to exclude such domains
Thanks
April 12th, 2008 at 3:44 pm
Try this ExtraSectionFirstColumnValues1:
It should exclude all domains containing “mail.“.
April 12th, 2008 at 4:36 pm
Thanks Jean-Luc
its working perfect 🙂