Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Old 08-27-2004, 09:25 PM htaccess question
Junior Talker

Posts: 2
Trades: 0
I read this in an online document:

With all the pieces in place, here's how to disable hot linking of images on your site. 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)$ - [F]

Be sure to replace "mydomain.com" with your own. The above code causes a broken image
to be displayed when its hot linked.


In my particular condition, I have a network of sites that all need to be able to hotlink my images, but I want to protect the site from unwanted bandwidth stealing.. what do I do? Add additional lines like line #3 in the code?


Thanks!
jprole is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-27-2004, 10:38 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
You can read here about the rewrite syntax.

You just need to add the 'OR' flag:

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain1.com/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain2.com/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain3.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 08-27-2004, 10:51 PM
Junior Talker

Posts: 2
Trades: 0
Thanks a lot!
jprole is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to htaccess question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22118 seconds with 12 queries