Results 1 to 6 of 6

Thread: Hotlink protection feature interfering with .htaccess

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    4

    Default Hotlink protection feature interfering with .htaccess

    I would like to use hotlink protection for a website I administer but allow facebook to pull images for link thumbnails. I've tried enabling hotlink protection and using different variations of the facebook url, maybe I'm not using the right one but it doesn't work for me.

    What I want to do is disable hotlink protection in cPanel and use the following in .htaccess

    Code:
    RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://mysite.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.mysite.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^https?://(www\.)?facebook\.com [NC]
    However cPanel almost immediately re-enables hotlink protection automatically trying to use my settings from .htaccess and the rewrite condition to allow facebook doesn't work.

    Is there a way to block cPanel from handling hotlink protection so I can do this with .htaccess or a way I can properly add facebook to the list of allowed sites in cPanel?

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,610
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Hotlink protection feature interfering with .htaccess

    Rather than enabling hotlink protection in cPanel, simply disable it and revise .htaccess manually. I'm uncertain why cPanel would revise your .htaccess directly unless you have hotlinking enabled, and if you don't enable it, you should be able to add whatever entries you would like in .htaccess
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Registered User
    Join Date
    Jul 2011
    Posts
    4

    Default Re: Hotlink protection feature interfering with .htaccess

    Quote Originally Posted by cPanelTristan View Post
    Rather than enabling hotlink protection in cPanel, simply disable it and revise .htaccess manually. I'm uncertain why cPanel would revise your .htaccess directly unless you have hotlinking enabled, and if you don't enable it, you should be able to add whatever entries you would like in .htaccess
    When I disable hotlink protection in cPanel and add the previously mentioned code snippet to .htaccess I go back to cPanel and find that hotlink protection is automatically re-enabled with the urls which I have added to .htaccess. the rewrite condition for facebook is included in the allow list as https?://(www\.)?facebook\.com and doesn't work. Disabling hotlink protection in cPanel and manually editing .htaccess is exactly what I've been trying to do. But manually editing .htaccess with these changes seems to automatically re-enable hotlink protection in .htaccess. No matter what I do cPanel seems to take over hotlink protection for me and it isn't working properly. What I need is a way to block cPanel from hijacking this functionality or I need the correct url to add to cPanel's allow list to allow facebook to pull thumbnails. I've tried Welcome to Facebook - Log In, Sign Up or Learn More, https://facebook.com, Welcome to Facebook - Log In, Sign Up or Learn More and https://www.facebook.com none of which allow facebook to pull the thumbnail images.

  4. #4
    Registered User
    Join Date
    Jul 2011
    Posts
    4

    Default Re: Hotlink protection feature interfering with .htaccess

    Okay I found the problem in .htaccess, what I needed was

    RewriteCond %{HTTP_REFERER} .

    To allow facebook since it doesn't have a referer. Problem solved.

  5. #5
    Registered User
    Join Date
    Oct 2012
    Posts
    1
    cPanel/WHM Access Level

    Website Owner

    Default Re: Hotlink protection feature interfering with .htaccess

    Quote Originally Posted by cPanelTristan View Post
    Rather than enabling hotlink protection in cPanel, simply disable it and revise .htaccess manually. I'm uncertain why cPanel would revise your .htaccess directly unless you have hotlinking enabled, and if you don't enable it, you should be able to add whatever entries you would like in .htaccess
    Unfortunately, enable and disable does not work. The broken cPanel HotLink Protection Tool is always on and you cannot turn it off since disable is also broken. Thank you.

    Please see these threads
    WordPress Support Broken cPanel HotLink Protection Tool - 404 errors, unable to edit files

    WordPress Support bulletproof-security.0.47.5 not working

  6. #6
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,610
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Hotlink protection feature interfering with .htaccess

    If you believe there is a bug, then please submit a bug report => http://go.cpanel.net/bugs

    That is the accepted method for bug submission.

    Thanks!
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads

  1. HotLink Protection affects RewriteEngine in .htaccess
    By emusic in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 09-03-2010, 03:40 PM
  2. Help with Hotlink Protection
    By adultx in forum Security
    Replies: 0
    Last Post: 03-12-2005, 03:51 PM
  3. Hotlink protection
    By ultramagna in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 03-11-2005, 09:58 PM
  4. Hotlink protection wipes .htaccess
    By Elpie in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 07-18-2004, 03:02 AM
  5. HotLink protection
    By kardukov in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 10-17-2003, 01:07 AM

Tags for this Thread

bargain