HI, I'm using .htaccess to protect my swf files being hotlinked by other sites. Here's my code. Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site1.be [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site2.nl [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site3.nl [NC] RewriteRule \.(swf|dcr)$ http://www.site1.be [NC,R,L] Code (markup): This code works in IE and Opera, but not in Firefox. Is there a fix for Firefox, because most of them are using Firefox.
I am not sure to understand what your real intention is besides avoiding/preventing hotlinking swf files but if I look at my working hotlink protection there would be one more line on top RewriteCond %{REQUEST_FILENAME} \.(swf)$ [NC] and if I look at your you are redirecting to your site/ mod_rewrite may efficiently prevent actual remote display of hotlinked pictures but it never stops ppl from still attempting to hotlink and those ppl will leave their hotlink alive and you will get lots of log lines about successful hotlink prevention I had a different approach ( I have/had MANY ten thousands of large format ( up to 1MB 2592x1944px ) from msn, myspace and all the other blog sites ... now after the mod_rewrite prevents hotlinking I still get ten thousands of hotlinking attempts - hence sitll a considerable server load at my expense - just for nothing ... so I decided IF they use my resources and $ at least I want to get some real value in return hence instead of just blocking hotlinking - I serve them an animated site-banner with some real site-promotion hence the last rule looks in my case like 2 points to consider when replacing a hotlink-file by another 1. PUT your replacement file into a totally separate subfolder and place into THAT special subfolder a .htaccess with the line RewriteEngine off ELSE you are going to LOOP endlessly - trying to replace the replacement file ... like a cat chasing and biting her own tail! in your case point #2 to consider would be I would make a clickable swf banner to replace hotlinked swf files - a small nice promo - linking to your site when ppl click on it this way all the swf files displayed by hotlinkers are replaced by your promo and some ppl click and come to your site ot find your swf offers at least a return for the additional serverload you get with or without mod_rewrite on your server. so may be a mod_rewrite like might work for you where hotlink_promo_banner.swf would be a swf banner to create by you to replace all hotlinked swf files and would have RewriteEngine off P.S.: question to some advanced forum members: how can i disable the active links in above code examples each time i highlight and click the no link button in advanced editor after i safe the text - all above links are hot again ??
HI Hans, I'm actually using the same method to protect swf files, but I'm doing this with an auto redirect page. Added this code: RewriteCond %{REQUEST_FILENAME} \.(swf)$ [NC] Its working with Firefox, but not only for hotlinkers but also my site is being rederected to the hompage. My English is not perfec, so I hope you understand me
if your own site is redirected then you have to exclude your own site from the mod_rewrite rule as far as I understand this from my own mod_rewrite this is done by adding a line for each domain that is allowed to hotlink your swf files in my case this looks like = kriyayoga.com = my site !! i "guess" it is the "!" at the beginning that defines the allowed URL vs the redirected URLs and make sure you have the replacement file in a folder with htaccess "RewriteEngine off"
This works only with IE and Opera, but in Firefox my own site is not allowed to view the swf files. Here is my code. Site1 is where the swf files are hosted.
did u clear the cache of your ffx browser to assure you are never getting the old redirect page instead of the original ?? clear all cache even better then restart ffx and try again
Still not working in Firefox, can't play teh game at site1 with firefox. Is there a special code for Firefox? Something like: RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost/.*$ [NC]
it might help to better assess your problem if you would give real site names then we can make real tests and have a look at real site/swf files did you ever test the full 8 lines given very early below ? in your code you still skip one like of the original code that works perfect for me ... and make sure EACH time you make any changes in mod_rewrite you als CLEAR your firefox cache !! i had many months ago same problems because my ffx kept showing the cache files instead of the real files ffx - in NEWEST version of course - needs to reload each page each time a page is displayed out form the web and never from cache - specially in any kind of games related pages that might help to prevent problems or even ffx crashes
Sorry for late reply. Here is the full code that I'm using now. Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} \.(swf)$ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?minispel.be [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?game-console.nl [NC] RewriteRule \.(swf)$ http://www.minispel.be/hotlink/500.php [R,NC,L] Code (markup): I deleted site3 for testing. Try this url with IE end Firefox: http://uwspelletjes.nl/spel-81-Alex-in-gevaar.html This site is not allowed to load the games but, Firefox will load the game while IE loads the redirect page. So I need a fix for firefox.
since you are NOT replacing a hotlinked file with another hotlinked file or URL but redirecting to another site may be your syntax needs to be different !!? all I can recommend you is to wait a while until Nintendo sees your post and may have time to give you expert advice - he is the true mod_rewrite expert here. I am NOT sure if what you do by redirecting a hotlinked pic(swf) to another site makes any real effective sense at all - whether this is actually possible from your side of the browser to cause on a remote site the surfer to be redirected to your site. a true mod_rewrite expert will know. my personal idea is that actually replacing a hotlinked pic by a promotional banner might be more effective and even drive you traffic to your site if someone still keeps the hotlink up ( in my case most ppl hotlinking still keep my banner even after months. you may also need to look at your php file that does the redirect the very first time i loaded the test page my ffx ( ffx2.0) had a new window open with the URL http://www.gametop.nl/cgi-bin/toplist/in.cgi?id=pasagli but that was in addition to the already and still working hotlinked page and it worked only the first time hence you may have a cookie that prevents the redirect/new window to work any number of times clear the cookies in your ffx and see yourself
a final thought about your method of hotlink prevention since you are opening another window originating from 3rd party site ( related to the hotlinking site ) your pop-up window will become victim of the more and more common ad blocker software or pop-up blocker SW hence this kind of opening a new window from a remote site when ever a pic is hotlinked may most likely never really work for you. all new browsers such as ffx are easy to configure to suppress just this kind of 3rd party windows opening wiht ads. the only thing that normally can NOT be blocked by remoted side or browser surfing on remote site would be a replacement file/pics/swf instead of the hotlinked one. hence my final conclusion: to be a 100% working hotlink-protection go back to either block w/o replacement or replace by swf file as mentioned earlier. I think you make things far more complex and far more inefficient than they need to be
Hi Hans, The link you've posted above is a partner link from my popup script on the game page, it has nothing to do with htaccess stuff. I've removed the popup script, the page is now popup save This code works fine, but only with IE and Opera. So, I need a fix for Firefox. All swf files are hosted on same server as minispel.be, and the htaccess file is also placed in the swf folder. When someone(website) is using my swf files, the user will see 500.php page and afther 7sec he will be redirect to minispel.be 500.php this page does the rederict and saves some info about hotlinkers, so I can contact them ask to remove the game. Everything is working in IE and Opera but, not in Firefox.
what you actually intend with your method of hotlink protection is to forcefully hijack a surfer from any remote site to your site may be firefox is simply hijack-proof if it would work - it definitely would be a bug/weakness of ffx unless a professional here can confirm that such site-visitors-hijack methods do legally work personally I belief it is a IE-weakness that this method works at all any such method normally might be controllable / suppressable by the browser' correct behavior (correct me if wrong ) did u ever try conventional hotlink-pic REPLACEMENT-methods ?? just replacing any hotlink pics with another pic ?? these are traditional methods that always work and are as efficient in causing the host of hotlinked picture to avoid hotlinking as your method but far easier and far more efficient to implement for me this topic is closed as I do NOT knwo any further and this methods are no traditional hotlink protection methods known to me with the use mod_rewrite may be nintendo knows a solution for you
Hi Hans, I did replace the redirect page with another swf file, but sitll not working. Firefox is still showing the games. I think Nintento is on holliday
then I dont know any further I guess you have to wait until nintendo is back from where ever he is he is the one to know all about mod_rewrite the code published is the one i use for gif and jpg hotlink replacement successfully by the thousands of uses daily