Greenguy's Board


Go Back   Greenguy's Board > Newbie Questions
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2005-06-15, 06:22 PM   #1
Boogie
I like to blog :)
 
Boogie's Avatar
 
Join Date: Sep 2003
Posts: 1,050
Little .htaccess help

I am looking for some help in blocking certain domains from hotlinking (instead them getting an error image)

I know how to do a blanket redirect but not one for specific domains :?

specifically I've got two sites showing up in referrals:

http://www.ridgeviewelem.org/

http://www.uccpp.org/


i dont know what they are and cant find any information on them (visiting them forwards me elsewhere) and am particuarlly worried about those domains.

any help?
__________________
I got a porn blog!
Got a blog worth linking to? Contact me
Boogie is offline   Reply With Quote
Old 2005-06-15, 06:27 PM   #2
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(.*@)?([a-z0-9-]+\.)*firstdomain\.com(:[0-9]+)?(/.*)?$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.*@)?([a-z0-9-]+\.)*seconddomain\.com(:[0-9]+)?(/.*)?$ [NC]
RewriteRule .*\.(asf|mpg|mpeg|wmv|avi|rm|gif|jpeg|jpg|zip)$ - [F,L]

the ! in the prior rules means, if it DOESN'T equal the following.

In this case, you remove the !, the rules have an implicit AND, but, you want an OR, so, if it matches firstdomain OR seconddomain, block.
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote
Old 2005-06-15, 06:35 PM   #3
Boogie
I like to blog :)
 
Boogie's Avatar
 
Join Date: Sep 2003
Posts: 1,050
thanks mate. does this look right?

RewriteCond %{HTTP_REFERER} ^http://(.*@)?([a-z0-9-]+\.)*http://www.ridgeviewelem/.org(:[0-9]+)?(/.*)?$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.*@)?([a-z0-9-]+\.)*http://www.uccpp/.org(:[0-9]+)?(/.*)?$ [NC]
RewriteCond %{HTTP_REFERER} ^http://(.*@)?([a-z0-9-]+\.)*http://www.myspace/.com(:[0-9]+)?(/.*)?$ [NC]
RewriteCond %{HTTP_REFERER} ^http://(.*@)?([a-z0-9-]+\.)*http://www.xanga/.com(:[0-9]+)?(/.*)?$ [NC]
RewriteCond %{HTTP_REFERER} ^http://(.*@)?([a-z0-9-]+\.)*http://www.penny-arcade.com(:[0-9]+)?(/.*)?$ [NC]
RewriteRule .*\.(asf|mpg|mpeg|wmv|avi|rm|gif|jpeg|jpg|zip)$ - [F,L]
__________________
I got a porn blog!
Got a blog worth linking to? Contact me
Boogie is offline   Reply With Quote
Old 2005-06-15, 06:36 PM   #4
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
you want to put the [NC,OR] on all lines except the last one
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote
Old 2005-06-15, 06:39 PM   #5
Boogie
I like to blog :)
 
Boogie's Avatar
 
Join Date: Sep 2003
Posts: 1,050
done. thanks mate. was worried about kids seeing stuff and penny arcade and that elementary school site are both kid related. dont want to make it any easier on those folks but at the same time i got a few hotlinking places i dont mind so much

thanks!
__________________
I got a porn blog!
Got a blog worth linking to? Contact me
Boogie is offline   Reply With Quote
Old 2005-06-15, 06:39 PM   #6
swedguy
Vagabond
 
swedguy's Avatar
 
Join Date: Aug 2003
Posts: 2,374
Send a message via ICQ to swedguy
Also the / in the domain should be a \
swedguy is offline   Reply With Quote
Old 2005-06-15, 06:42 PM   #7
Boogie
I like to blog :)
 
Boogie's Avatar
 
Join Date: Sep 2003
Posts: 1,050
ok fixed both!
__________________
I got a porn blog!
Got a blog worth linking to? Contact me
Boogie is offline   Reply With Quote
Old 2005-06-15, 09:20 PM   #8
Xeno
Do you want the job done right, or do you want it done fast?
 
Xeno's Avatar
 
Join Date: Jun 2005
Location: Canada
Posts: 494
Not sure if you are aware of this link http://www.htaccesstools.com/hotlink-protection/ ...about htaccess for anti-hotlinking ? I know sometimes when I review submitted sites with htaccess for preventing hotlinking, they forget about the people who use anti virus and personal firewalls which often breaks all images and graphics on a website that uses this method to prevent hotlinking. The problem is blank referrers...so in my submission rules if anyone does this, I gave them that link to solve the broken site images...
__________________
Why I never sleep anymore...
Web Designing
Xeno is offline   Reply With Quote
Reply


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

Forum Jump


All times are GMT -4. The time now is 11:20 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc