Bluepearl Design
Go Back   Bluepearl Design > Misc > Tutorials > HTML, XHTML, Javascript, CSS

Screwing with your HTACCESS to STOP IMAGE HOTLINKING!!!

HTML HyperText Markup Language.
XHTML Extensible Hypertext Markup Language.
JAVASCRIPT object-based scripting programming language.
CSS Cascading Style Sheets.

    

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 10-19-2005, 09:39 AM   #1 (permalink)
 
SpawnDemon's Avatar
 
Title: Bluepearl Veteran
Join Date: Jul 2005
Location: Philadelphia, Pennsylvania - Home Base
Posts: 727
Rep Power: 4 SpawnDemon is on a distinguished road
Send a message via MSN to SpawnDemon Send a message via Skype™ to SpawnDemon
Screwing with your HTACCESS to STOP IMAGE HOTLINKING!!!

HOW DO I STOP HOTLINKING AND BANDWIDTH THEFT?

You can stop servers from hotlinking your site's files by editing the .htaccess file in your site's root directory. (Consult your webhost on accessing your .htaccess file.)


Example: Your site url is www.example.com. To stop hotlinking images from an outside domain and display an image called nohotlink.jpg instead, use this code in your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com/ [NC
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(jpe?g|gif|bmp|png)$ images/nohotlink.jpg [L]


To allow hotlinking images only if the REFERER (sic) is from a specific directory from your domain:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com/dir/ [NC
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(jpe?g|gif|bmp|png)$ images/nohotlink.jpg [L]


To stop hotlinking images from specific outside domains only, named badsite.net and badsite.com:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite\.net/ [NC,OR
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite\.com/ [NC
RewriteRule \.(jpe?g|gif|bmp|png)$ images/nohotlink.jpg [L]


Limit bandwidth usage by returning a 403 forbidden code. Replace the last line of the previous examples with this line:

RewriteRule \.(jpe?g|gif|bmp|png)$ - [F]
<img height="1" width="1" border="0" src="http://pagead2.googlesyndication.com/pagead/imp.gif?event=noiframe&client=ca-pub-3963608149933108&dt=1129671446109&lmt=1108 428680&alternate_ad_url=http%3A%2F%2Faltlab.co m%2***ar.cgi%3Finput_mode%3Dsoftware%26input_id%3D 229637&format=120x600_as&output=html&c hannel=7284726313&url=http%3A%2F%2Faltlab.com% 2Fhtaccess_tutorial.html&color_bg=F8F8F8&c olor_text=666666&color_link=CC0000&color_u rl=999999&color_border=F8F8F8&ref=http%3A% 2F%2Fwww.google.com%2Fsearch%3Fhs%3DLVy%26hl%3Den% 26lr%3D%26client%3Dfirefox-a%26rls%3Dorg.mozilla%253Aen-US%253Aofficial_s%26q%3Dhotlink%2Bhtaccess%26btnG% 3DSearch&cc=92&u_h=864&u_w=1152&u_ ah=830&u_aw=1152&u_cd=32&u_tz=-240&u_his=6&u_java=true&u_nplug=24&amp ;u_nmime=96" /> Warning: Do not use .htaccess to redirect image hotlinks to another HTML page or server that isn't your own (such as this web page). Hotlinked images can only be redirected to other images, not to HTML pages.

As with any .htaccess rewrites, you may block some legitimate traffic (such as users behind proxies or privacy firewalls) using these techniques.


__________________
What did he say? A new e1studios site? Where can I get some. Click Here!
SpawnDemon is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-19-2005, 05:42 PM   #2 (permalink)
 
Title: Bluepearl Veteran
Join Date: Feb 2005
Posts: 1,848
Images: 9
Rep Power: 6 Kate will become famous soon enoughKate will become famous soon enough
Re: Screwing with your HTACCESS to STOP IMAGE HOTLINKING!!!

Thanks for adding
Kate is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-20-2005, 12:15 AM   #3 (permalink)
 
Fragalot's Avatar
 
Title: Ipood
Join Date: Nov 2004
Location: belgium west-flandres
Age: 19
Posts: 4,442
Images: 1
Rep Power: 9 Fragalot is on a distinguished road
Send a message via ICQ to Fragalot Send a message via MSN to Fragalot Send a message via Yahoo to Fragalot
Re: Screwing with your HTACCESS to STOP IMAGE HOTLINKING!!!

or do it the easy way:
go into Cpanel, follow the hotlinking url.
then you follow their steps ^^
Fragalot is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-22-2005, 08:05 AM   #4 (permalink)
 
Sean's Avatar
 
Title: Founder/Admin
Join Date: Jan 2004
Location: Sydney, Australia
Age: 28
Posts: 8,907
Images: 386
Blog Entries: 4
Rep Power: 10 Sean will become famous soon enough
Send a message via MSN to Sean Send a message via Skype™ to Sean
Re: Screwing with your HTACCESS to STOP IMAGE HOTLINKING!!!

Thanks for adding.

btw Fragalot not everyone has cpanel
Sean is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-22-2005, 08:38 PM   #5 (permalink)
 
Fragalot's Avatar
 
Title: Ipood
Join Date: Nov 2004
Location: belgium west-flandres
Age: 19
Posts: 4,442
Images: 1
Rep Power: 9 Fragalot is on a distinguished road
Send a message via ICQ to Fragalot Send a message via MSN to Fragalot Send a message via Yahoo to Fragalot
Re: Screwing with your HTACCESS to STOP IMAGE HOTLINKING!!!

Quote:
Originally Posted by Sean
Thanks for adding.

btw Fragalot not everyone has cpanel
they should
... i hate helm ...
Fragalot is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-22-2005, 10:27 PM   #6 (permalink)
 
Sean's Avatar
 
Title: Founder/Admin
Join Date: Jan 2004
Location: Sydney, Australia
Age: 28
Posts: 8,907
Images: 386
Blog Entries: 4
Rep Power: 10 Sean will become famous soon enough
Send a message via MSN to Sean Send a message via Skype™ to Sean
Re: Screwing with your HTACCESS to STOP IMAGE HOTLINKING!!!

Quote:
Originally Posted by fragalot
they should
... i hate helm ...
lol
Sean is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-27-2005, 02:31 AM   #7 (permalink)
 
Title: Bryan
Join Date: Jan 2004
Location: Dundee
Age: 21
Posts: 3,547
Rep Power: 8 wasahobo is on a distinguished road
Send a message via AIM to wasahobo Send a message via MSN to wasahobo
Re: Screwing with your HTACCESS to STOP IMAGE HOTLINKING!!!

Very nice man,

ThankYou for adding
__________________
BluePearl-Design + 3sStudios = Unlimited Possibilities.


Current Project: http://www.3sstudios.com/cloud.htm
wasahobo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


  
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Bluepearl Templates

All times are GMT +11. The time now is 05:30 PM.

 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52