Optimizing Website Server Bandwidth - Bandwidth-Saving Tips
(Page 4 of 4 )
The most important corrective action is to prevent hot linking. This can be done using .htaccess in an Apache web server. Say you will only allow access to the following file types within your domain www.thisisyourwebsite.com (for both http and https version) as well as your sister domain, http://www.yoursisterdomain.com :
## DISABLE HOTLINKING
RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?thisisyourwebsite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://(www.)?thisisyourwebsite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?yoursisterdomain.com/.*$ [NC]
RewriteRule .(gif|jpg|jpeg|png|bmp|js|css|xsl|mpg|mov)$ - [F]
Replace the domain name examples above with your own domain name. If someone tries to steal your content and publish it on their own website while it is still hosted in your server (this is called “hot linking”), it will be blocked and denied by the server.
Next, if there are links pointing to the location of your downloads, captcha is used so that bots will not be able to download the file unintentionally (only humans are allowed to access downloadable content). This will also save some bandwidth.
Finally, GZIP compression is enabled in the server. There are a lot of ways to do this; discussing them is beyond the scope of this article. The images are also resized so that they won’t consume a lot of bandwidth while the site is loading.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |