How to Configure Hotlink Protection in cPanel

From: Features and How-Tos Last Updated: 9 months ago

 

Hotlink protection in cPanel prevents other websites from directly linking to your site’s files, such as images, videos, or documents. This helps save bandwidth and ensures that your resources are not misused. Follow this guide to configure Hotlink Protection in cPanel.

Step 1: Log in to cPanel

  1. Open your web browser and navigate to your cPanel login page (e.g., https://yourdomain.com/cpanel).
  2. Enter your username and password to access the cPanel dashboard.

Step 2: Locate the Hotlink Protection Tool

  1. In the cPanel dashboard, scroll down to the Security section.
  2. Click on Hotlink Protection.

Step 3: Enable Hotlink Protection

  1. On the Hotlink Protection page, click Enable to turn on the feature.
  2. Once enabled, you’ll see configuration options to customize Hotlink Protection.

Step 4: Configure Allowed Domains

  1. Add your website and any trusted domains to the URLs to allow access field. For example:
    • https://yourdomain.com
    • https://www.yourdomain.com
    • https://trustedsite.com (if applicable).
  2. These domains will still be able to access your files directly.

Step 5: Block Specific File Types

  1. In the Block direct access for these extensions field, specify the file types you want to protect. Common extensions include:
    • .jpg
    • .png
    • .gif
    • .mp4
    • .pdf
  2. These file types will no longer be accessible via direct links from unauthorized domains.

Step 6: Customize Redirect URL (Optional)

  1. Enter a redirect URL to display a specific message or page to users who attempt to hotlink your files. For example, you can redirect them to a 403 Forbidden error page or your homepage.

Step 7: Save Changes

  1. After configuring the settings, click Submit to save your changes.
  2. Hotlink Protection is now active on your website.

Step 8: Test Hotlink Protection

  1. Visit an unauthorized website and attempt to hotlink one of your protected files.
  2. The file should no longer load or will redirect to the URL you specified.

Tips for Hotlink Protection

  • Avoid Overblocking: Ensure you don’t block access to critical resources that should be publicly available, such as CSS or JavaScript files.
  • Monitor Bandwidth Usage: Use cPanel’s Bandwidth tool to identify unauthorized hotlinking before enabling protection.
  • Disable If Not Needed: If your site doesn’t host large media files, hotlink protection may not be necessary.

By enabling and configuring Hotlink Protection in cPanel, you can safeguard your website’s resources, save bandwidth, and prevent unauthorized usage of your files.

Bottom ad position