Boosting online traffic is one of the main goals for virtually every website on the Internet. A conscientious site owner, seeking to optimize performance, will regularly check detailed traffic logs available through their hosting account or a third-party service, like Google Analytics.

One very big potential problem that can be quickly detected involves the unauthorized use of files from your website by another Internet property. You must be watchful for this practice, especially if your site contains a lot of attractive image files, because it can significantly inflate traffic figures very quickly.

When checking website traffic data, review the amount of bandwidth that has been consumed for the current month. Bandwidth represents cumulative file usage. The set amount per month should not be exceeded. If it is, site visitors will be treated to a page displaying a warning message that the bandwidth limit has been exceeded. They will not be able to access any areas of the site.

Needless to say, this situation needs to be quickly remedied by either increasing the existing bandwidth limit, or by purchasing more from your hosting company. The latter option can be very expansive, so it behooves every site owner to ensure that he or she is getting the ‘most bang for the buck’ in terms of visitor usage.

It can, therefore, be a heart-stopper when you log in during the first week of the month, and find out that, say, over 40% of your assigned bandwidth has already been consumed.

Given that trend, you will very likely run out before the end of the month. Further investigation is needed. First, check the stats for the Referral Sites to see if an inordinate amount of visitors came from one specific URL outside if your own domain.

Then, look closely at which specific files have been most accessed by visitors. If an attractive image file happens to be one of them, it may mean that you’ve become the victim of bandwidth theft, and that the high traffic number is partially being generated by another site that has posted a direct link to your image.

If the other site attracts a large volume of traffic, such as an active message board or social media site, it will cause a tremendous spike in your monthly bandwidth transfer total. This practice is known as ‘hotlinking’.

In short, it means that lots of precious bandwidth is being burned up with virtually no benefit to you. Instead, an unscrupulous site owner is using your image(s) to adorn his or her site. It also may be that a poster to a message board has hotlinked to your image, a development that the other site owner might be unaware of.

.HTACCESS file

The solution to the problem of hotlinking is a properly constructed ‘.htaccess’ file. This file, which is utilized to limit online access to certain site components, sits in your site’s root (main) directory.

To create the file, open a basic text editor like Notepad (Windows), or TextEdit (Mac). Copy a designated group of lines into the file, depending on your need, and paste them into an empty text file, as outlined below:

Options:
1) To stop hotlinking of any site images by displaying a replacement graphic when someone tries to do so, copy and paste the following lines.

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png)$ http://i.imgur.com/qX4w7.gif [L]

Replace ‘mysite’ in the second line with your own URL. If your domain ends in ‘.net’ or ‘.org’ instead of ‘.com’, change that as well.

Save the file as htaccess.txt, and place it in the first hierarchal line of the stored website on your hard drive – the same line as your index (home page) file.

Upload the file to your server, then rename the txt file to .htaccess in your online directory.

After the adjustment to the .htaccess file name, a would-be hotlinker will see a graphic displayed on his or her site that states, “Warning: Do not hotlink images and steal bandwidth”, instead of your image file.

2) To prevent hotlinking from specific outside domains only, such as facebook.com, blogspot.com or myspace.com, but allow any other web site to hotlink images, utilize:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?facebook\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?blogspot\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?myspace\.com/ [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ http://i.imgur.com/qX4w7.gif [L]

As many domains as you like can be added to this expression. Every RewriteCond line should end with the [NC,OR] code, except the last one.

Website owners should be vigilant about checking for bandwidth theft. Once detected, a properly constructed .htacces file will permanently prevent this issue from occurring.

  • Windows Classic Theme + DW CS3? Really? its 2012.

    • Eliezer Herrera

      aarggg, and so?, is about .htaccess file…. -.-

  • designcouch

    Who even uses Dreamweaver anymore? Buggy and bloated as all get out. Coda FTW!

    • Dave

      To each their own, I guess. I’ve used DW for a long time and it suits my purposes very well.

  • What ever happened to “Dont be evil” 😉
    Instead of blocking images.. use this opportunity for advertising your site!… use waterstamps on your images instead!

    • Dave

      Waterstamping is certainly an option. However, you don’t want to get into a situation where a high-traffic site, like a message board, is burning up a lot of your bandwidth and providing no benefit for you. It happened to me, and was a nightmare until I found the solution. That’s why you have to be selective in how you utilize the .htaccess file to deny access only to those sites that are misusing your content..

  • designcouch

    Aaron – perhaps you need to redefine “troll”? That was a legitimate question. With much better software out there, for less money (Coda, Espresso etc), it doesn’t make a whole lot of sense to use something like DW. The only market (by and large) that uses it anymore are designers who are uncomfortable writing their own code – and this is actually a problem that creates a lot of the bloat on the web.

    If you’re the one user who is actually using Dreamweaver to write your own code, more power to you!

Home XML WordPress Web Services Web Development Web Design Underscore Uncategorized Tutorial Tools SQL Server Social Apps Snippet SEO Security RoR Responsive Design Resources Python PHP News MySQL Mobile Miscellaneous jQuery JavaScript Java J2EE HTML5 HTML Design Patterns