Jump to content
Sign in to follow this  
Lonelydreamer

Preventing Hotlinking From Specified Sites

Recommended Posts

I want to be able to deny access to images from only specified sites. I haven't seen any other posts like this so I thought I might as well ask. I have asked around and have been lead to belive that this can be done with some additions to the .htaccess file(s). Thanks for all your help.

Share this post


Link to post
Share on other sites

The easiest way to do this is to go into cpanel and use the hotlinking option on the right I believe under site maintenance.

 

In the large box on that page type all the sites you want to allow to hotlink. All others will be un available.

 

I just recently started using this system again. It works great, but I would like to forward all unavailable hotlinks to another image. But hot linking disables it :dance:

 

Instead of a red X I would like to have an image that says hotlinking is disabled from this domain. Anyone know how this can be done? I'm sure it is .htaccess modification

 

edit: just figured an easy way to do it. I don't use png files on my site at all. So I just removed png from the extensions at the bottom and saved my file as sorry.png

 

sorry.png

 

And it works like a charm :)

Share this post


Link to post
Share on other sites

The reply above doesn't exactly help me, I know about the hotlinking manager provided within cpanel, but that hasn't been the best for me, so I want to deny the certain sites that are hotlinking access instead of blocking all.

Share this post


Link to post
Share on other sites

You may try one of these...

http://wsabstract.com/howto/htaccess10.shtml

http://httpd.apache.org/docs/mod/mod_rewrite.html

 

>RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://site.that.shouldnt.be.linking.com$ [NC]
RewriteRule \.(gif|jpg)$ - [F]

 

or

 

>RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://site.that.shouldnt.be.linking.com$
RewriteRule \.(gif|jpg)$ http://www.****/nasty.gif [R,L]

 

If I'm reading the rewrite manual correctly then these should work. The second would of course forward the hotlinked image to that image. This should disable it for just that site, but I'm not positive.

Share this post


Link to post
Share on other sites

You could also consider simply banning those IP addresses that you don't want hotlinking to your site. That may be more drastic than you want, though! :)

Share this post


Link to post
Share on other sites

I tried this but even if I IP Deny a domain name it will still be able to link my images. I think that I will look into some other things Thanks for your help everyone!!

Share this post


Link to post
Share on other sites

Ip denying wouldn't have any effect because the person viewing the webpage is calling the image. The server is just essentially linking.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...