Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- attempt to block hot-linking actually blocks everything


Boule_de_poils - 9:36 am on Sep 22, 2002 (gmt 0)


Thanks for your reply!

Here is the .htaccess file (all .htaccess files used on this server are named htaccess.fi) I am currently using:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domainA\.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://tempo\.domainB\.org/xiaoping/.*$ [NC]
RewriteRule ^.*\.gif$ http://www.domainA.org/test/stop.gif [R]

The folder to protect is [domainA.org...]

"http://tempo.domainB.org/xiaoping/" is the alternate address for my site, and it works fine (pictures show, both through img src and link).

Here are the addresses you can use for testing (every picture has a link to itself too):

[domainA.org...] --> Should work, but doesn't
[tempo.domainB.org...] --> Works fine, OK.
[splor.domainC.fr...] --> Shouldn't work, OK.

If I remove the second rewrite condition, then the stop.gif picture shows for the second address, which is what is expected. But it is the only case when it works.

I think there's been a small change since last evening, as direct-linking with img src doesn't work anymore with a remote address. I'll contact the server admin to clarify this.

At the root (http://www.domainA.org/), I also have another .htaccess file for 404 errors:

<Files htaccess.fi>
order allow,deny
deny from all
</Files>
ErrorDocument 404 http://www.domainA.org/404.php

[edited by: DaveAtIFG at 4:34 pm (utc) on Sep. 23, 2002]
[edit reason] Changed to "generic" URLs [/edit]


Thread source:: http://www.webmasterworld.com/apache/33.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com