Forum Moderators: phranque

Message Too Old, No Replies

.htacces is not working on Firefox

         

anversli

3:31 pm on Aug 22, 2006 (gmt 0)

10+ Year Member



Hi,

I need some help with my .htaccess file.
To protect my swf files on my server, I placed a .htaccess file to stop hotlinking.

Here is the code off my .htacces file.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?example1.be [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?example2.nl [NC]
RewriteRule \.(swf¦dcr)$ http://www.example1.be/500.html [NC,R,L]

The swf files are hosted on www.example1.be and ww.example2.nl is my second game site. As you see www.example2.nl is allowed to link the swf files, but this code is not working in Firefoxe.

When I wanna play a game with firefox on both websites, I get a message "Stop Hotlinking" and it redirect me to www.minispel.be, but he has to do this only with other websites.

It works perfect with IE and Opera, but not in Firefox.

Can someone help to fix this script for Firefox.

[edited by: jdMorgan at 7:20 pm (utc) on Aug. 22, 2006]
[edit reason]
[1][edit reason] examplified [/edit]
[/edit][/1]

Philosopher

3:38 pm on Aug 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It sounds like Firefox is not sending the http referer header which is why it's not working. The htaccess fix you are using requires that the referer header be sent so that it can test it.

If nothing is sent, it fails your test and you get the error.

I would add another RewriteCond to the top of your ruleset

RewriteCond %{HTTP_REFERER}!^$

That should fix the problem by testing for the blank referer as well.

By the way, you will want to edit your post to remove your actual urls as specific URLs are not allowed.

anversli

5:27 pm on Aug 22, 2006 (gmt 0)

10+ Year Member



I got this error message with the you gave me.

The server encountered an internal error or misconfiguration and was unable to complete your request

I changed the code like this.

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http(s)?://(www\.)?siteone.be [NC]
RewriteCond %{HTTP_REFERER}!^http(s)?://(www\.)?site2.nl [NC]
RewriteRule \.(swf¦dcr)$ [siteone...] [NC,R,L]

BTW how can I edit my post?

jdMorgan

7:22 pm on Aug 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Missing spaces between "}" and "!"?

The problem is not with Firefox, but with the 'player' plugins for Firefox. If they don't send a Referer header, your original code will reject the request. It's also possible you've disabled sending referers in the Firefox about:config options.

Jim