Icy Phoenix

     
 


Post new topic  This topic is locked: you cannot edit posts or make replies. 
Page 1 of 1
 
 
Reply with quote Download Post 
Post How To Preventing Hot Linking Of Images And Other File Types 
 
Hi there,

After looking at my sites referres I was a little pissed off that some clever guy is hotlinking to my site. After looking around for a solution I found that .htaccess is probably the easiest to implement.

Simply add the below code to your .htaccess file, and upload the file either to your root directory, or a particular subdirectory to localize the effect to just one section of your site:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?mydomain.com/.*$ [NC]
RewriteRule .(gif|jpg|js|css)$ - [F]


Be sure to replace "mydomain.com" with your own. The above code creates a failed request when hot linking of the specified file types occurs. In the case of images, a broken image is shown instead.

Now for the tricky part where I need help

If "the clever guy" uses this particular link: http://www.icyphoenix.com/image_thu...4237_212683.png

the script doesnt work. Now the only way this link i generated is if you right clik an image and view it in your browser, if you note the url is kinda generated twice... But if someone tries to hotlink the image through the original link: http://www.icyphoenix.com/files/ima...4237_212683.png then the script does it's job nicely.

Can MG or someone come up with a solution for this
 



 
jzSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: How To Preventing Hot Linking Of Images And Other File T 
 
You should perform the check even on the Query String...

Use this to refer to the Query String:
Code: [Download] [Hide] [Select]
{QUERY_STRING}


You can then make the same checks you were performing on {HTTP_REFERER}.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Post new topic  This topic is locked: you cannot edit posts or make replies.  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events


  

 

  cron