user606346
user606346

Reputation: 157

.htaccess: Disable hotlinking (via redirect)

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?

Upvotes: 0

Views: 639

Answers (1)

Clodoaldo Neto
Clodoaldo Neto

Reputation: 125204

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

Upvotes: 1

Related Questions