Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Hotlink protection

Options
  • 08-07-2009 11:44am
    #1
    Closed Accounts Posts: 9,273 ✭✭✭


    Hi,

    Do you know if blacknight have any plans to enable hotlink protection on your windows hosting plans' control panel ?

    I can see the flash tutorial on your site but apparently this is a linux-hosting only feature. Thanks in advance.


Comments

  • Registered Users Posts: 62 ✭✭leonvquinn


    Isn't this achievable with just a few lined in a .htaccess file?


  • Registered Users Posts: 236 ✭✭jamesnp


    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ image_to_show.jpg [NC,R,L]

    Windows supports htaccess, doesn't it? :-/


  • Registered Users Posts: 7,739 ✭✭✭mneylon


    The .htaccess method might work, but it would depend on which server your site is on ie. ISAPI Rewrite is enabled on most of them


  • Closed Accounts Posts: 9,273 ✭✭✭Morlar


    blacknight wrote: »
    The .htaccess method might work, but it would depend on which server your site is on ie. ISAPI Rewrite is enabled on most of them

    Thanks for the info.

    So I just need to ensure ISAPI rewrite is enabled for this webspace, then either create or edit a .htaccess in /webroot

    add these lines :

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)blahblah.com [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ image_to_show.jpg [NC,R,L]

    and it will prevent hotlinking ?

    The second question is there a way to allow it for certain domains using this method (ie as you can using the Linux control panel method)? Or am I missing something there?


  • Registered Users Posts: 236 ✭✭jamesnp


    Morlar wrote: »
    Thanks for the info.

    So I just need to ensure ISAPI rewrite is enabled for this webspace, then either create or edit a .htaccess in /webroot

    add these lines :

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)blahblah.com [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ image_to_show.jpg [NC,R,L]

    and it will prevent hotlinking ?

    The second question is there a way to allow it for certain domains using this method (ie as you can using the Linux control panel method)? Or am I missing something there?

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?alloweddomain2.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?alloweddomain3.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?alloweddomain4.com [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ image_to_show.jpg [NC,R,L]


  • Advertisement
  • Closed Accounts Posts: 9,273 ✭✭✭Morlar


    jamesnp wrote: »
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?alloweddomain2.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?alloweddomain3.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?alloweddomain4.com [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ image_to_show.jpg [NC,R,L]


    Thanks a lot - will try that later :)


  • Registered Users Posts: 7,739 ✭✭✭mneylon


    Morlar wrote: »
    Thanks for the info.

    So I just need to ensure ISAPI rewrite is enabled for this webspace, then either create or edit a .htaccess in /webroot

    Pretty much - yes

    As for the actual syntax - I'm not a regex person - sorry :)


  • Closed Accounts Posts: 9,273 ✭✭✭Morlar


    This worked - cheers.


Advertisement