Prevent Hotlinking From Your Proxy Website and Save Bandwidth

Posted by Vectro 3 July 2010

When someone hotlinks your proxy pages, it can eat precious bandwidth which costs money. This occurs when a user browses to a page via your web proxy, then copies the proxied URL and pastes it on a web page or forum. The hotlink protection built into PHPRoxy is extremely weak. Glype’s anti-hotlink feature works better, but is not perfect. The purest way to block hotlinkers is at the server level. This is done by modifying (or creating) an .htaccess file. This only applies to Linux web servers. If you’re not sure, ask your host.

Here is the code to place in your .htaccess file. If you already have a file with this name, add the snippet to the very bottom. If not, just create a file with that name, add the code and upload it to the root directory of your website. Make sure to replace all instances of example.com with your actual domain name. If for example you decided to rename browse.php to a different name like surf.php, change ^browse\.php$ to ^surf\.php$. If you have one .htaccess file controlling all of your sites, you only need to use this code once in that file as long as browse.php has the same name on all sites. If it has a different name on each site, you will need to use a separate .htaccess file for each one.

Glype hotlink protection:


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/ [NC]
RewriteRule ^browse\.php$ http://example.com/403.shtml [R,NC]

Allow specific sites to hotlink Glype:


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?exampletwo.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?examplethree.com/ [NC]
RewriteRule ^browse\.php$ http://example.com/403.shtml [R,NC]

PHProxy hotlink protection:


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/ [NC]
RewriteRule ^index\.php$ http://example.com/403.shtml [R,NC]

Allow specific sites to hotlink PHProxy:


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?exampletwo.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?examplethree.com/ [NC]
RewriteRule ^index\.php$ http://example.com/403.shtml [R,NC]

PHP Proxy Hosting with Specialized Features and Tech Support

Sorry, comments are closed.

Previous Post
«
Next Post
»