Troels Jacob Ringsmose Feddersen
2012-04-30 13:31:12 UTC
I'm setting up apache2 on a virtual ubuntu 12.04 server. I installed the
lamp-stack at server installation time. The server is going to host
mediawiki 1.8, and serve some files that I don't want people to be able
to hotlink. The following is a test of mod_rewrite and put in
/etc/apache2/httpd.conf:
RewriteEngine On
RewriteLog "/var/www/log/rewrite.log"
RewriteLogLevel 9
RewriteCond %{HTTP_REFERER} !(192\.168\.150\.130)
RewriteRule .*png$ - [F]
The virtual machine has 192.168.150.130 for IP and no domain name. I'm
trying to prevent downloading any png file, without the referer being my
server. For some reason this doesn't work. I know that the file is used
by the server, because if I mug up the path to my log file, the server
won't start, and the apache log states that the file couldn't be found.
The weird part is, that the log isn't touched (and the apache user is
the owner and has write access) and I can get download png files without
a referer. So this leaves me to think, that the either the RewriteCond
line i messed up, or something prevents it from being used.
I'd be grateful for any ideas
lamp-stack at server installation time. The server is going to host
mediawiki 1.8, and serve some files that I don't want people to be able
to hotlink. The following is a test of mod_rewrite and put in
/etc/apache2/httpd.conf:
RewriteEngine On
RewriteLog "/var/www/log/rewrite.log"
RewriteLogLevel 9
RewriteCond %{HTTP_REFERER} !(192\.168\.150\.130)
RewriteRule .*png$ - [F]
The virtual machine has 192.168.150.130 for IP and no domain name. I'm
trying to prevent downloading any png file, without the referer being my
server. For some reason this doesn't work. I know that the file is used
by the server, because if I mug up the path to my log file, the server
won't start, and the apache log states that the file couldn't be found.
The weird part is, that the log isn't touched (and the apache user is
the owner and has write access) and I can get download png files without
a referer. So this leaves me to think, that the either the RewriteCond
line i messed up, or something prevents it from being used.
I'd be grateful for any ideas
--
regards
Troels
regards
Troels