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

AWStats, hotlinking pages
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:\/\/(.*)$"

7 Responses to “Hotlinking Pages”

  1. Tim Trott says:

    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.

  2. Jean-Luc says:

    Hi Tim,

    Thanks for your comments. Try this to limit the length to 80 characters:

    ExtraSectionFirstColumnFormat1="<A HREF='http://%s' TARGET='_blank'>%.80s</A>"

  3. Amie Stilo says:

    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.

  4. YIH CHUAN says:

    How to hide a referer spam in AWStats?

  5. Nadeem says:

    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

  6. Jean-Luc says:

    Try this ExtraSectionFirstColumnValues1:

    ExtraSectionFirstColumnValues1="REFERER,^(?!http:\/\/www.your_site.com|https?:\/\/[^\/]*mail\.)http:\/\/(.*)$"

    It should exclude all domains containing “mail.“.

  7. Nadeem says:

    Thanks Jean-Luc
    its working perfect 🙂


 

Leave a Reply

You must be logged in to post a comment.