Home » Proxy Articles » Hotlinking prevention with PHProxy
Hotlinking occurs when someone links directly to an image or web page through your proxy. This effectively steals your bandwidth and bypasses your homepage where the majority of your ad revenue sources are going to be located.
As such, one of the first steps you should take as a web proxy owner is to implement sufficient hotlinking protection especially when using PHProxy because the existing system is simply not good enough.
It is very quick and easy to implement using our PHP code below. All you need to do is open up your "index.php" file in a text editor such as Notepad. Locate the line which reads:
error_reporting(E_ALL);Directly beneath that line copy and paste the hotlinking prevention code:
// Prevent Hotlinking by azproxies.com$domain="myproxydomain.com";
if ($_GET['q']!="" && strpos($_SERVER['HTTP_REFERER'],$domain)===false)
{
header("Location: http://www.".$domain."/");
exit();
}
The only edit that you need to make is to replace myproxydomain.com with the domain name of your web proxy. You must not include the www. prefix as this is not required.
Save the file and upload it to your server and your all set with hotlinking prevention.