Set Up: Hotlink Protection in cPanel
Hotlinking is the displaying of an image (or any type of files) on a website by linking to another website, rather than saving a copy of it on the website on which the image will be shown. You may think you are saving your own server disk space by opting not to upload the image to your own server. But hotlinking creates more problems than that.
Imagine one of your images on your website is hotlinked to by a high traffic website, such as Twitter or Reddit. Because the image is served from your server, it uses your bandwidth every time the image is served. Not only will it result in the consumption of extra hosting resources, it will drastically increase your bandwidth usage. Server and website performance will be affected and you may incur over-usage penalty and possible resource upgrade fees. Not to mention, if you are using a web statistics monitoring services, such as Google Analytics, you may find inaccurately attributed traffic hits.
You can use the Hotlink Protection tool in cPanel allows you to prevent other websites from directly linking to files on your website.
Enable hotlink protection
To enable hotlink protection on your website:
- Click Hotlink Protection under Security in cPanel.
- Click Enable.
- Under URLs to allow access enter the websites you wish to allow hotlinking to your website.
- If you want to block certain file types from being access, add those file extensions to the Block direct access for the following extension text box. When you block these file types, others cannot hotlink those types of files from your website. For example, to block all .jpg images, add .jpg to the text box.
- To allow visitors direct access to specific content through the URL, select the Allow direct requests option. 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 visitors in the Redirect the request to the following URL text box. Visitors from blocked sites will see this page instead of the hotlinked file.
- When ready, click Submit.