Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  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
    6,305
    cPanel/Enkompass 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, Forums Technical Analyst, 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.

Similar Threads & Tags
Similar threads

  1. HotLink Protection affects RewriteEngine in .htaccess
    By emusic in forum cPanel and 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 and WHM Discussions
    Replies: 0
    Last Post: 03-11-2005, 09:58 PM
  4. Hotlink protection wipes .htaccess
    By Elpie in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 07-18-2004, 03:02 AM
  5. HotLink protection
    By kardukov in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-17-2003, 01:07 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube