How to prevent hotlinking on your CGI based proxy.

Previously I wrote a code about how to prevent hotlinking on your PHProxy. This time around you will learn how to prevent hotlinking on your CGI Proxy script.

Open up your nph-proxy.cgi with notepad or your favorite text editor.
Look for this line.

$HTTP_1_X=  $NOT_RUNNING_AS_NPH   ? ‘Status:’   : “HTTP/$HTTP_VERSION” ;

Below the line, add this line and change the domain with your own.

if($ENV{’HTTP_REFERER’} =~ /^http:\/\/www.yourdomain.com/)
{
}
else
{
&redirect_to(’http://www.targetdomain.com/’, ”);

What it does, whenever people hotlinked your proxy, they will be directed to the address that you specify above.
If you are wanting to get rid of them for good, perhaps shoving them off to my listing site can do you good. lol.

You can show your support by buying me a coffee

Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Technorati
  • Facebook
  • Furl
  • Reddit

These post might interest you

  • No Related Post



Leave a comment