Knowledge Base Navigation
Articles: 51 Categories: 8
KB Article: Bandwidth Protection with .htaccess
Article: | Bandwidth Protection with .htaccess |
Submitted By: | Telli |
Date Added: | 04-27-2004 5:27:37 |
Hits: | 7,554 |
Bandwidth protection
Have you ever skyrocketed over your allocated bandwidth and you have no idea why. Do you have downloads or lots of images on your site. If so, then it is likely that some other site is linking to your downloads and taking all your bandwidth. If you are serving adds, then you probably won't mind as long as the visitor sees the banners. But usually they won't. So how to you stop these people downloading from your site? Here's how. In your .htaccess file you write some code that makes sure that the referring (Previous) URL was a URL that you want people to be able to download from. Type the following into your text editors changing the necessary parts:
AuthUserFile /dev/null
AuthGroupFile /dev/null RewriteEngine On RewriteCond %{HTTP_REFERER} !>http://www.example1.com [NC] RewriteCond %{HTTP_REFERER} !>http://example1.com [NC] RewriteCond %{HTTP_REFERER} !>http://www.example2.com [NC] RewriteCond %{HTTP_REFERER} !>http://www.example3.com [NC] RewriteCond %{HTTP_REFERER} !>http://200.25.25.100 [NC] RewriteRule /* http://www.example.com/index.html [R,L] "RewriteCond %{HTTP_REFERER} !>http://www.example1.com [NC]" is the URL or URLs that the downloads will be allowed from. "RewriteRule /* [ Register or login to view links on this board. ] [R,L]" is the page that the surfer will be redirected to if they do try to download from an unauthorised URL. This file needs to be uploaded in ASCII mode to the directory that contains the downloads that you wish to protect. You change the URL to your own. Remember you must add [NC] after the rewriteCond Phrase and [R,L] after the RewriteRule Phrase. |
Current rating: 8.13 by 86 users
Please take one second and rate this article... |
Not a Chance | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Absolutely |
Please register or sign-in to post comments.