.htaccess: Disable hotlinking (via redirect)

641 views Asked by At

I am hosting a site that has some flash in it. Now a different site is linking directly to the flash, causing massive traffic for me. The problem: I do not gain any ads which would help me pay the server bills. I thought it would be OK to redirect the direct link to the flash to the site containing it.

Flash: www.example.com/flash/1.swf Page: www.example.com/1 (<-- redirect here!)

It probably should work with .htacess, but I have no idea how. Maybe you can help me?

1

There are 1 answers

0
Clodoaldo Neto On
RewriteCond %{HTTP_REFERER} !www\.example\.com
RewriteRule /flash/(.+)?\.swf$ www.example.com/$1 [L,R]