vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=262655

Complete Hotlink Protection
by naveeid
26 Apr 2011 06:27

Title : Complete Hotlink Protection

Version : 1.1

Coder : naveeid
Purpose : Prevent your forum attachments from being directly linked to - prevent bandwidth abuse.

Why : My dedicated server was down due to too many hotlinked image connections. i was feeling helpless. even after protecting images through .htaccess, images were still hot linked through attachment.php



How : just edit your server .htaccess and modify the code with your domain names



Installation :
edit your .htaccess file.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


1) please change yourfirstwebsite.com and yoursecondwebsite.com to your websites on that cpanel account. if you dont have a second website then you can remove that line

2) i am allowing google to fetch images or attachments for their server. if you dont want to allow google then just remove that line.

3) replace anypic.jpg with your website banner or hotlink warning banner.

it works very fine. its the simplest and easiest available soloution.

Demo:-
i have installed it on my website , you can check my website for hotlink protection.
http://www.nidokidos.org/attachment....3&d=1302073196
now this image will show in my website , this image will be displayed if opened it in a browser. but if it will be opened in any other website , it will be replaced by my website banner.

Boofo 26 Apr 2011 07:51

Code removed

naveeid 26 Apr 2011 08:05

well if a server is already overloaded , then it should not allow any directory to be hotlinked.

Boofo 26 Apr 2011 08:15

You don't have to put anything in to that directory if you don't want to. It just allows you to if ever needed.

And your Google code is redundant as this takes care of it already:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


naveeid 26 Apr 2011 11:28

Quote:

Originally Posted by Boofo (Post 2188771)
There is an easier and better way to do this and allow images to be hot-linked from one directory only (for posting error pics and avatars on other sites if they don't allow them locally).


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Use either of the last 2 lines depending on what you want.

Boofo is there any solution for hotlinking through attachment.php in these lines?

Boofo 26 Apr 2011 22:32

Do you allow guests to download attachments?

naveeid 27 Apr 2011 04:32

well in my forum guests are allowed to download attachments and view attached images.

naveeid 27 Apr 2011 04:46

through this mod , if any picture will be embedded/hotlinked through attachment.php on any OTHER website , it will display website banner or warning picture instead. similarly any other mp3 or download links of your forum files will be placed on any OTHER website , they will show your website banner or bandwidth theft warning when clicked.

Boofo 27 Apr 2011 05:00

No problem. I have removed my code.

MissKalunji 03 May 2011 15:17

Where should this go? in forum? or root?

Boofo 03 May 2011 15:19

Root.

MissKalunji 03 May 2011 15:20

and if the image isn't available....

What will it show?

the standard vb error message?

MissKalunji 03 May 2011 15:29

what if my attachement.php

is under a different folder?

billstelling 03 May 2011 21:52


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

is that correct?

opps put the wordpress in the wrong spot.. fixed
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?thewindowscenter.wordpress\.com/ [NC]

Boofo 03 May 2011 22:15

naveeid, your attachment.php line does not work. I set guests to be able to download/view attachments, and this did not stop anyone from another site being able to hotlink it. When I set guests back to not be able to view or download attachments, then they got the login screen on a hotlink. But they got that anyway before the attachment.php line was added to the htaccess. So that code is redundant.


All times are GMT. The time now is 14:36.

Powered by vBulletin® Version 3.8.13
Copyright © 2019, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.