How to Set Up Hotlink Protection in cPanel
Introduction
At Lanetti, we prioritize the security of your website and its resources. Hotlinking occurs when another website directly links to your images, videos, or other media files, causing your server to handle the additional traffic without your consent. This can slow down your website and may even lead to bandwidth theft. cPanel’s Hotlink Protection tool can prevent hotlinking and keep your resources secure. This guide will show you how to set up hotlink protection in cPanel to protect your website's media files.
What Is Hotlinking?
Hotlinking is when another website embeds your media files (such as images or videos) directly on their pages by linking to them. While it may seem harmless, hotlinking can drain your bandwidth and server resources. Hotlink protection blocks unauthorized websites from linking to your files, helping you preserve your bandwidth and keep your site loading fast.
How to Set Up Hotlink Protection in cPanel
Step 1: Log in to Your cPanel
- Open your browser and navigate to your cPanel login page (e.g.,
https://yourdomain.com/cpanel
). - Enter your username and password, then click Log in.
Step 2: Access Hotlink Protection
- In the cPanel dashboard, locate the Security section.
- Click on Hotlink Protection.
Step 3: Enable Hotlink Protection
- In the Hotlink Protection page, click the Enable button to activate the feature.
- cPanel will automatically block other websites from using your media files.
Step 4: Define Allowed Domains
- In the URLs to allow access field, you can list specific domains that are allowed to hotlink to your files. For example:
- www.yourdomain.com
- yourdomain.com
- subdomain.yourdomain.com
- Add any trusted websites that you want to allow to use your resources by separating them with a space.
Step 5: Configure Hotlink Protection Settings
-
Choose a Default Action: Select how you want to handle requests for blocked hotlinking:
- Show a custom error page: Redirect users to a specific page (e.g., an image or a warning page).
- Show a 403 Forbidden error: Display a 403 error to prevent access.
- Show a default image: Display a placeholder image (e.g., a "No hotlinking" image).
You can upload the image to be shown in the Default Image field, or leave it blank for a 403 error.
-
Click Submit to apply your changes.
How to Test Hotlink Protection
- After enabling hotlink protection, test by trying to access one of your media files from another domain. If hotlink protection is working, the file will not be accessible, and the user will either see the error page or a placeholder image you specified.
How to Disable Hotlink Protection
- To disable hotlink protection, simply go back to the Hotlink Protection tool in cPanel.
- Click the Disable button to remove the protection.
Important Notes
- Whitelisted Sites: Make sure you only whitelist trusted sites to avoid giving unauthorized sites access to your media files.
- Images and Resources: Hotlink protection can be applied to any file type (images, videos, etc.) hosted on your server.
- SEO Considerations: If you have third-party websites or affiliates that require linking to your media files, be sure to whitelist them.
For further assistance with hotlink protection or to resolve any issues, contact Lanetti Support. We're here to ensure your website is secure and optimized!