Stopping hotlinks from a site and all it's subdomains?

Fix it!!

Stopping hotlinks from a site and all it's subdomains?

Postby Light Speed » Sun Jul 13, 2008 4:36 am

A blog site in another county has a bunch of it's members hotinking from my site.

I have tried stopping them but my syntax must be wrong because it only stops some of them.

The site is and the members each have their own subdomain like this

my code below is replacing my image with one from the main blog at and it is working for but not for probably because of the hyphen. How do I account for that in my code?

Code: Select all
RewriteCond %{HTTP_REFERER} ^http://([a-z0-9]+\.)?blog\.cz(/.*)?$ [NC]

RewriteRule ^store/files/images/(.*)$ [L]

I also want anybody who is not from who tries to hotlink to get a banner from my site:
Code: Select all
RewriteRule ^store/files/images/(.*)$  Banners/redirect_banner.gif [L,R=301]

How can I accomplish both of these at the same time?
Light Speed
Posts: 3
Joined: Sun Jul 13, 2008 4:18 am

Postby richardk » Sun Jul 13, 2008 10:52 am

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_REFERER} ^http://(.+\.)?blog\.cz(/.*)?$ [NC]
RewriteRule ^store/files/images/(.*)$ [L]

RewriteCond %{HTTP_REFERER} !^http://(.+\.)?example\.com(/.*)?$ [NC]
RewriteRule ^store/files/images(/.*)?$ /Banners/redirect_banner.gif [R,L]

Where is your domain.
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Return to Security with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 3 guests