Forum Moderators: phranque
2)
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^$ [OR]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?example\.com/.*$ [NC]
RewriteRule .*\.([zip¦rar¦exe¦gif¦jpg¦jpe?g]+)$ - [NC,F]
3)
RewriteEngine On
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER}!^http://.*example\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://6x\.2xx\.x4\.x8
RewriteRule \.(zip¦exe¦rar)$ - [NC,F]
4)
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^http://(www\.)?example\.(net¦com) [NC]
RewriteRule \.(zip¦rar¦exe¦gif¦jpe?g)$ - [NC,F]
5)
RewriteEngine On
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER}!^http://.*example\.com [NC]
RewriteRule \.(zip¦exe¦rar)$ - [NC,F]
6)
RewriteEngine On
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER}!^http://(www\.)?example\.(net¦com) [NC]
RewriteRule \.(zip¦rar¦exe¦gif¦jpe?g)$ - [NC,F]
Additionaly, I have the following in my http.conf
<Directory "/home/directory/www/screenshots">
Options FollowSymLinks
AllowOverride All
</Directory>
LoadModule rewrite_module modules/mod_rewrite.so
Apart from that, my /home/directory/www/screenshots/.htaccess file has the following properties:
-rwxr-xr-x 1 apache apache 164 Apr 24 16:24 .htaccess
I don't remember which of these codes worked, however, I remember that at least some of them blocked images and/or downloads.
However, I've done many configurations to my server since then. The ones that I think could affect referrers are these:
- I have Kiss 2.0 firewall (edited), which forwards any incoming request for port 80 to port81
- Apache runs in port 81
- Squid runs in port 80, working as an http accelerator.
Could anybody help me please? Any ideas?
What if I use this in the httpd.conf file?
<Directory "/home/directory/www/screenshots">
SetEnvIfNoCase Referer "http://www.example.com/" local_ref=1
<FilesMatch ".(gif¦jpg)">
Order Allow,Deny
Allow from env=local_ref
</FilesMatch>
</Directory>
Regards
I hope you'll take ownership of your own project, and read some of the threads here [google.com] describing anti-hotlinking methods; Only by understanding mod_rewrite and the various issues surrounding hotlink prevention (especially when it it referrer-based) can you choose the right method for your site. It's up to you to decide what you need to do, implement it, and test it. We can only give general advice or help with very specific code problems.
Jim
In fact I've read numerous posts about mod_rewrite
The frustrating part is that they just don't work on my server.
I think it's because my server is listening to port 81, and squid is listening to port 80. Apart from that, by using Iptables, I redirect incoming requests for port 80 to port 81.
These .htaccess files used to work in the past, however they are just now working at the moment.
I even tried the following in apache:
</home/example/www/images>
Options All
Allow Override All
Then I tried the 6 .htaccess files I described above, and still, nothing worked.
I inserted a direct link to one of my images in another's site forum, and the image always displays.
and I did inserted the .htaccess in the /home/example/www/images/ directory
Any clues?
Regards
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^test_mod_rewrite\.html$ /index.html [R=301,L]
Jim
these are the contents of
/home/www/.htaccess
redirect 301 /index.* [socceraccess.com...]
You can test it at www.fifala.com, it forwards to the spanish version of my site.
However when I enter any of the 6 examples I mentioned before at the following directory:
/home/www/images/.htaccess
it doesn't works.
I've tested the Chown and Chmod settings, and they are excactly the same as the ones from the /www/.htaccess file.
I've also doubled checked all the apache settings, and they give /home/www/images even higher privileges than /home/www ones.
I've posted every possible thing that I estimate usefull, do you know what else could I do?
What about my site running on port81 with squid on port 80?
Regards