Results 1 to 10 of 10
  1. #1

    Using ,htaccess to stop stealing .wmv files being streamed from server

    I have wrote myself a .htaccess code where I can stop another site from opening (as a link) say a .wmv file from my server. But I have noticed some have gotten smart and are using the embed tags to show it directly in their site - is there any way to stop this using .htaccess?

    Thanks

  2. #2
    Join Date
    Jan 2008
    Location
    St. John's, NL
    Posts
    2,114
    Are you using cPanel by any chance? If so, try the "Hotlink Protection" option. It can help you and is much better than a single .htaccess file.
    Cpanel/WHM PHP Perl Ruby Full Time Support
    LCWSoft - Canada web hosting (based in Newfoundland) since 2007
    Servers based in the US and Canada (Uptime Report)

  3. #3
    Join Date
    Jan 2008
    Location
    St. John's, NL
    Posts
    2,114
    Also, did you try

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?yourwebsite\.com [NC]
    RewriteRule \.(wmv|flv)$ - [F,NC,L]
    Replacing "yourwebsite.com" with your domain?
    Cpanel/WHM PHP Perl Ruby Full Time Support
    LCWSoft - Canada web hosting (based in Newfoundland) since 2007
    Servers based in the US and Canada (Uptime Report)

  4. #4
    I will try that out, I had something similar to your code but nevertheless, hope it works

    Edit - also , I am not using cPanel

  5. #5
    I tried your code larwilliams, it stops it a bit too well - it won't open from my domain.com now And yes, I changed the

    "yourwebsite\.com" chunk to my domain like you suggested...

  6. #6
    Join Date
    May 2004
    Posts
    394
    Try this code:
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
    RewriteRule \.(wmv)$ - [NC,F,L]
    Replace yourdomain.com to your domain.

  7. #7
    Join Date
    Jan 2008
    Location
    St. John's, NL
    Posts
    2,114
    That is virtually identical to what I posted, except mine is a bit more lenient with subdomains.

    Are you trying to view the WMV through a media player? If so, I'd guess that HTTP_REFERER isn't being set. Not sure what to do about that.
    Cpanel/WHM PHP Perl Ruby Full Time Support
    LCWSoft - Canada web hosting (based in Newfoundland) since 2007
    Servers based in the US and Canada (Uptime Report)

  8. #8
    Join Date
    May 2004
    Posts
    394
    Hmm, for Media player, I think we can use this:
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} !^Windows-Media-Player [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} !^NSPlayer [NC]
    RewriteRule \.(wmv)$ - [NC,F,L]
    What do you think?

  9. #9
    Yes, I can download the file just fine with the code you guys have provided me - BUT I cannot view it through media player (like watch it inside the browser, which is something that I need for my site) Please help!

  10. #10
    Ok this is what I have - which is semi-working, but other people can still use the embed tags to stream the file from my server

    Code:
    RewriteEngine  on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^https?://(www\.)?domain1.com/?.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^https?://(www\.)?domain2.com/.*$ [NC]
    RewriteRule \.(wmv)$ - [F,NC]
    I have tried the codes you guys suggested, the first code by almahdi and Ianwilliams allowed me to download the file off the server but not see the .wmv file as a stream (i.e open in a window in firefox/ open in windows media player)

    Second code by almahdi doesn't allow me to download or stream

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •