Stopping People Hotlinking SWF files


#1

Hi

I need some help, ive set up the htaccess in my Dreamhost panel but it seems useless, ive also made 2 lots of htaccess files, but neither of them seem to work.

Can anyone guide me on this, everywhere I look seems to be for images only, ive modded the coding to no joy :frowning:


#2

Did you add swf to the list of forbidden file extensions?


#3

re re-edit

doh now my punters need to enter a password as well, I did enter swf, in the htacess file and webdav/htaccess control panel


#4

im still having problems with this the dreamhost panel seems to ignore everything I do.

I have other hosting and stopping hotlinking access is a breeze.


#5

You’d get more help if you could provide more information about what you have already tried outside of the DreamHost panel functions.

The Apache documentation covers the URL Rewriting module known as mod_rewrite and there is a section in the Guide located at http://httpd.apache.org/docs/misc/rewriteguide.html under the heading Blocked Inline-Images.

This section has two examples, and the first is for blocking access to a GIF file unless the referrer is blank or happens to match URLs that should be allowed to link to the GIF. All you would have to do is copy those three lines into a text file, changing ‘gif’ to ‘swf’ and naturally the URL regexp to that of your own. Don’t forget to begin with a ‘RewriteEngine on’ directive.

:cool: Perl / MySQL / HTML+CSS


#6

thanks will read that now :slight_smile:

the .htaccess codes i have tried so far is

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?chaffinchshoelace.com(/)?.$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?chaffinchshoelace.com(/)?.
$ [NC]
RewriteRule .*.(swf|SWF|wmv|WMV)$ - [F,NC]

and

Code:
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://chaffinchshoelace.com/.$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.chaffinchshoelace.com/.
$ [NC]
RewriteCond %{HTTP_REFERER} !^http://chaffinchshoelace.co.uk/.$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.chaffinchshoelace.co.uk/.
$ [NC]
RewriteRule .*.(swf|wmv|gif|GIF|jpg|JPG)$ - [F]

and

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www.)?chaffinchshoelace.com(/)?.$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?chaffinchshoelace.com(/)?.
$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?chaffinchshoelace.co.uk(/)?.$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?chaffinchshoelace.co.uk(/)?.
$ [NC]
RewriteRule .*.(gif|jpg|jpeg|bmp|swf|wmv)$ http://img159.exs.cx/img159/9674/oiii8qi.gif [R,NC]


#7

Works for me.

Went to http://www.chaffinchshoelace.com/flash.php?id=31

And found the Pilsbury SWF. Loaded in the page OK.

Found the URL and copied it into the location bar:

http://www.chaffinchshoelace.com/flash/pilsbury.swf

Did a Refresh and it got redirected to your “stop stealing bandwidth” image.

Uploaded a page to my site that links to the Flash on your site.

http://atropos.openvein.org/web/dreamhost/apache/

Upon viewing the page, the Flash is not loaded. The LiveHTTPHeaders extension does show that the attempt to load it resulted in a redirect to your “stop stealing bandwidth” image. Naturally since that is an image and not a SWF file, Macromedia does not show anything and accessing the Flash menu indicates “Movie not loaded…”

Now, apparently you are using

RewriteEngine on RewriteCond %{HTTP_REFERER} !^http://(www\.)?chaffinchshoelace.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?chaffinchshoelace.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?chaffinchshoelace.co.uk(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?chaffinchshoelace.co.uk(/)?.*$ [NC] RewriteRule .*\.(gif|jpg|jpeg|bmp|swf|wmv)$ http://img159.exs.cx/img159/9674/oiii8qi.gif [R,NC]
Because the lack of

RewriteCond %{HTTP_REFERER} !^$is what is activating the redirect when copying the URL to the location bar.

The (/)? is not necessary - the referrer should have the / no matter what, it is not optional unless the browser is buggy. And obviously as written, this will not work in subdomains other than www.

:cool: Perl / MySQL / HTML+CSS


#8

you are a diamond, though now i can get the files to load on the domain itself www.chaffinchshoelace.com