Home > Help Center > Shared Hosting > Control Panel > Hotlink Protection in cPanel

Hotlink Protection in cPanel

Hotlink protection prevents other websites from directly linking to files on your website.

An example of hotlinking would be using a <img> tag to display an image from your site from somewhere else on the net. The end result is that the other site is stealing your bandwidth.

When you disable hotlinks, make certain that you allow hotlinks for any necessary domains. For example, your website's subdomains and the URL that you use to access your cPanel account.

If the URL that you use to access your cPanel account does not appear in the List the URLs to which you wish to allow access list, you may not see embedded images in the HTML Editor in the File Manager interface.

Enable hotlink protection

Login cPanel > Security and click Hotlink Protection link:

cpanel hotlink protection

A hotlink occurs when someone embeds content from your site in another site and uses your bandwidth to serve the files. You can use this interface to prevent this issue.

Click Enable:

cpanel hotlink protection

A confirmation message will appear:

cpanel hotlink protection

List all sites from which you wish to allow direct links. cPanel attempts to add all sites it knows you own to the list; however, you may need to add others:

cpanel hotlink protection

To block direct access to files of specific types, add those file extensions to the Block direct access for the following extensions list:

cpanel hotlink protection

For example, to block all .jpg images, add .jpg to the Block direct access for the following extensions list.

When you block these file types, others cannot hotlink those types of files from your website, regardless of any other settings.

Other sites will still be able to link to any file type that you don't specify. To allow visitors access to specific content through the URL, select the Allow direct requests option:

cpanel hotlink protection

For example, if you enable this option, a visitor could enter http://www.example.com/folder/example.jpg as a URL to access the example.jpg file.

To redirect requests for certain content, enter the URL to which you want to redirect your visitor in the Redirect the request to the following URL text box:

cpanel hotlink protection

Click Submit.

Disable hotlink protection

To disable hotlink protection, click Disable:

cpanel hotlink protection

When you click Disable, the system deletes the entries in the List the URLs to which you wish to allow access list. We strongly recommend that you save the list locally before you disable hotlink protection.

Let's see how hotlink protection actually works.

In a webpage we've inserted the URL of an image from another site. The domain of that webpage is not in the list of the allowed access URLs.

The image itself is accessible in it's own webpage and also as an URL:

cpanel hotlink protection

cpanel hotlink protection

http://hostpulse-demo.com/wp-content/uploads/2016/08/cmp-1code-min.jpg

But the page that tried to embed (hotlink) the image can not access it and displays only the alt text:

<img src="http://hostpulse-demo.com/wp-content/uploads/2016/08/cmp-1code-min.jpg" alt="hotlink protection alt text" />

cpanel hotlink protection

Conclusion

Hotlink protection is a useful tool that will prevent other sites to steal from your bandwidth.

#cpanel #security #images

Still not finding what you're looking for?

Contact our support team with any additional questions or concerns.

Contact support