How to stop hot linking

Discussion in 'Install/Configuration' started by Yogesh Sarkar, Jan 25, 2013.

  1. Yogesh Sarkar

    Yogesh Sarkar Banned

    I am running 2 CPU license of Litespeed with LASPI (not running suEXEC) with vbulletin forum.

    I want to stop people from hot linking our attachments, since due to vb using php to serve those attachments; it wastes a lot of our resources.

    I am not quite sure how to go about it, since CPanel Hot Lijnk protection doesn't seems to work with Litespeed, though I didn't try it with Apache either, so not sure if it works with it either.
    Last edited: Jan 26, 2013
  2. NiteWave

    NiteWave Administrator

    the post is not complete yet, can you complete it first ?
  3. Yogesh Sarkar

    Yogesh Sarkar Banned

    Sorry about that, have completed the post now.
  4. NiteWave

    NiteWave Administrator

    I'm not familiar with CPanel Hot Link protection yet. but it can be easily to do in .htaccess. here's an example:

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g?|png|swf|flv|mp4|mp3)$
    [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?mydomain.com [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?google\. [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?yahoo\. [NC]
    RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?bing\. [NC]
    RewriteRule \.(gif|jpe?g?|png|swf|flv|mp4|mp3)$ - [F,L]
  5. Yogesh Sarkar

    Yogesh Sarkar Banned

    It seems to stop normal images to be embedded elsewhere, but doesn't stops the attachments to be embedded elsewhere, like this.

    [​IMG]
  6. NiteWave

    NiteWave Administrator

    while attachment can be embedded elsewhere, can it be downloaded ?
  7. Yogesh Sarkar

    Yogesh Sarkar Banned

    It can be downloaded.

    Real problem are the image attachments, which are uploaded on our forum and then reposted elsewhere. While its not a major annoyance, it causes extra resource and bandwidth usage, which I would like to avoid, without disabling attachments for guests.
  8. webizen

    webizen New Member

    you should try in Apache first make sure it works before switch to lsws.
  9. Yogesh Sarkar

    Yogesh Sarkar Banned

    Had been scouring through vb and vb.org, looks like there is no easy solution for stopping vb attachments to be embedded elsewhere, due to the fact that it is dynamic URL.

Share This Page