View Single Post
Old 06-26-2003, 12:18 AM  
fiveyes
Confirmed User
 
Join Date: Aug 2001
Location: New Orleans
Posts: 1,680
Quote:
Originally posted by save11
htaccess question:

Is this the proper format for blocking hotlinking by domain?
sogclub being the domain that is hotlinking

xxx being my (i wish) hehe domain



RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?sogclub.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]

Also, can you insert ip in place of domain name with this format?
Thanks

ex:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?65.125.235.178.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]
There's no difference between "(/)?.*" and simply ".*", they both accept the same strings. The problem is, neither of those two regexes reject anything, it's a useless bit in rewrite code that someone wrote early on and has been repeatedly copied. Numerical IP addreesses will have neither the "www." nor the ".com". So, I'd write this as:

<B>RewriteCond %{HTTP_REFERER} !^http://65.125.235.178[NC, OR]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?sogclub.com[NC]
RewriteRule \.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]</B>
__________________
<CENTER><A HREF="http://www.hot-off-bourbon.com/" target="_blank"><IMG SRC="http://www.hot-off-bourbon.com/images/hob-logosmall.jpg" border="0"></A>

<FONT face="Comic Sans MS" SIZE="-1"><I>Mardi Gras, Spring Break, Wet-T, Night Club Action, UpSkirt, Oil Wrestling, Voyeur</I></FONT></CENTER>
fiveyes is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote