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
.htaccess to prevent certain domains hotlinking
Old 03-22-2004, 02:03 PM .htaccess to prevent certain domains hotlinking
Junior Talker

Posts: 1
Trades: 0
Hello,

these are great forums, I have enjoyed browsing and have decided to sign up, unfortunately for my first post to be a question.

I have been searching how to stop certain domains from hotlinking with htaccess. I have come across scripts/tutorials which show how to prevent hotlinking from all sites or only from allowed sites. Neither of these are pratical for me as I own a toplist . What i want to do is block a domain(s) from hotlinking from my site. For example www.stupidsite.com hotlinks a image from my site, I would want to stop that image althogether from loading on that site or be swapped for another (horrible ) picture.

I would really appreciate your help, thanks in advance.
kebab is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-27-2004, 01:58 PM Referer-based Deflector
Skilled Talker

Posts: 75
Location: New Jersey, USA
Trades: 0
This is from http://httpd.apache.org/docs-2.0/misc/rewriteguide.html

Description:
How can we program a flexible URL Deflector which acts on the "Referer" HTTP header and can be configured with as many referring pages as we like?

Solution:
Use the following really tricky ruleset...

RewriteMap deflector txt:/path/to/deflector.map

RewriteCond %{HTTP_REFERER} !=""
RewriteCond ${deflector:%{HTTP_REFERER}} ^-$
RewriteRule ^.* %{HTTP_REFERER} [R,L]

RewriteCond %{HTTP_REFERER} !=""
RewriteCond ${deflector:%{HTTP_REFERER}|NOT-FOUND} !=NOT-FOUND
RewriteRule ^.* ${deflector:%{HTTP_REFERER}} [R,L]

... in conjunction with a corresponding rewrite map:

##
## deflector.map
##

http://www.badguys.com/bad/index.html -
http://www.badguys.com/bad/index2.html -
http://www.badguys.com/bad/index3.html http://somewhere.com/

This automatically redirects the request back to the referring page (when "-" is used as the value in the map) or to a specific URL (when an URL is specified in the map as the second argument).
__________________

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

Where you can get personal, online!
eBlush_Hector is offline
Reply With Quote
View Public Profile Visit eBlush_Hector's homepage!
 
Reply     « Reply to .htaccess to prevent certain domains hotlinking
 

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.52686 seconds with 12 queries