[Resolved] Ban Hotlinking via htaccess

jkeegan

Active Member
#1
As per this doc:

http://docs.joomla.org/How_do_you_block_direct_hot_linking_to_image_files_using_.htaccess

I am trying to ban specific domains from hotlinking using this:

Code:
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?myspace\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?blogspot\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?livejournal\.com/ [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ - [F]
But that's not working... Do I need to do something different in litespeed?
 
Last edited by a moderator:

mistwang

LiteSpeed Staff
#2
It should work well.

Code:
RewriteCond %{HTTP_REFERER} ^[URL="http://%28.+%5C.%29/?%28myspace%7Cblogspot%7C%5C.com/"]http://(.+\.)?(myspace|blogspot|[/URL][URL="http://%28.+%5c.%29/?livejournal%5C.com/"]livejournal)[/URL][URL="http://%28.+%5C.%29/?%28myspace%7Cblogspot%7C%5C.com/"]\.com/[/URL] [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ - [F]
is more efficient
Have you enabled rewrite in .htaccess? You can trouble shoot it by enabling rewrite log.
 

jkeegan

Active Member
#3
RewriteEngine on and rewrite log doesn't seem to tell me anything... Site is real busy so rewrite log went to 1 GB in minutes so it's hard to find anything in there...
 

NiteWave

Administrator
#4
can you post 1~3 lines of access log which still access the image files from myspace etc? so we can analyze why the rewrite rule not working?
 

jkeegan

Active Member
#5
OK, I was using those hosts to protect the client's privacy. They were trying to block other hosts than myspace. I will send in a ticket. Thank you.
 

jkeegan

Active Member
#7
Looks like the rule is fine, the files were just being caught by some rule earlier in the chain... When I moved them to the top of the file it worked fine.

Thanks!
 
Top