Forum Moderators: open

Message Too Old, No Replies

Blocking Hotlinks - browser differences?

         

Vo_DDich

2:24 am on Mar 24, 2008 (gmt 0)

10+ Year Member



hi i'm new to this hosting and hotlinks and all. I read a few forums about hotlinks and tried out. i ran into a weird problem, firefox blocked what i wanted to block AND MORE! :(

Firefox:
it blocks everything i put in my hotlinks, but for some reason it seems to block my flash gallery from reading the hotlinks file. My flash read in a XML file, but hotlinks seems to block it from reading it! They're all on the same directory/folder.

IE:
On the other hand, if i load up the blocked files the first time it shows. However, if i click "refresh" the files get blocked.

i emailed my hosting support and everything, but they're no help what so ever. :(

Wish i can just post my own URL on here so everyone can see what's going on, or maybe just my computer but i don't think i'm allowed to post my own URL.

please help :(

my .htaccess file

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.example.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.example.com$ [NC]
RewriteRule .*\.(xml¦js¦jpg)$ http://www.example.com/ [R,NC]

[edited by: tedster at 3:08 am (utc) on Mar. 24, 2008]
[edit reason] switch to example.com - it can never be owned [/edit]

g1smd

2:38 am on Mar 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



When you click refresh on an image, there is no referrer, so you need to allow a "blank" referrer to have access too.

Don't forget to allow for the possibility of a port number in the URL and/or non-www URLs too.

Vo_DDich

2:48 am on Mar 24, 2008 (gmt 0)

10+ Year Member



what's port number in the URL? how do i allow that ? sorry i'm a bit new to this

jdMorgan

3:28 am on Mar 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




RewriteEngine on
# If referrer is non-blank
RewriteCond %{HTTP_REFERER} .
# and referrer is not our own site (www or non-www)
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC]
# Return 403-Forbidden response
RewriteRule \.(xml¦js¦jpg)$ - [F]

Replace the broken pipe "¦" characters above with solid pipe characters; POsting on this forum modifies the pipe characters.

Completely flush your browser cache before testing any new .htaccess code.

If you use a custom 403 error page, add another RewriteCond to the code:


RewriteCond %{REQUEST_URI} !^/path-to-custom-403-error-page\.html$

otherwise you'll get an 'infinite' loop on 403 errors. Replace "/path-to-custom-403-error-page\.html" with the correct path to your custom 403 error page.

Jim

Vo_DDich

3:51 am on Mar 24, 2008 (gmt 0)

10+ Year Member



i tried above but it doesn't seem to work at all

RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC]
RewriteRule \.(xml¦js¦jpg)$ - [F]

[edited by: tedster at 3:48 am (utc) on Mar. 25, 2008]
[edit reason] switch to example.com - it can never be owned [/edit]

g1smd

6:07 pm on Mar 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Flush your browser cache first.

Better yet, view it on a browser that has never looked at your site before.

Vo_DDich

6:17 pm on Mar 24, 2008 (gmt 0)

10+ Year Member



i tried that too :( i tried on many different machines. all came up the same.