Description

This function enables hotlink protection for a site.

 If visitors arrive at a specific filetype through a URL that the allowed list does not include, hotlink protection redirects users to another URL.

Examples 


$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$add_hotlink = $cpanel->api1('Mime', 'add_hotlink', array('http://example.com','jpg,jpeg,gif,png,bmp',"http://goaway.com/','0') ); // Call the function.

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $add_hotlink = $cpliveapi->api1('Mime', 'add_hotlink', ['http://example.com','jpg,jpeg,gif,png,bmp',"http://goaway.com/','0'] ); # Call the function.

<cpanel Module="Mime::add_hotlink( $FORM('urls','exts','redirect','direct') )">
cpapi1 --user=username Mime add_hotlink http://example.com jpg,jpeg,gif,png,bmp http://goaway.com 0

This function does not return output.

Parameters

ParameterTypeDescriptionPossible ValuesExample
urls
string

Required

The URL or URLs that may hotlink to your site.

One or more valid URLs, separated by newline characters.http://example.com
exts
string

Required

The file types to protect from hotlinks.

A comma-separated list of valid file extensions.
jpg.jpeg,gif,png,bmp
redirect
string

Required

The URL to which to redirect hotlink protection violators.

Any valid URL.http://goaway.com
direct
BooleanWhether to allow users to directly visit a file with a matching extension.
  • 1 — Allow.
  • 0 — Do not allow.
0

Returns

This function does not return output.