2011/11/6 Leonardo M. Ramé <martinr...@yahoo.com> > >________________________________ > >From: Yehuda Katz <yeh...@ymkatz.net> > >To: users@httpd.apache.org; Leonardo M. Ramé <martinr...@yahoo.com> > >Sent: Saturday, October 29, 2011 11:44 PM > >Subject: Re: [users@httpd] Blocking referer problem > > > > > >2011/10/29 Leonardo M. Ramé <martinr...@yahoo.com> > > > > > >>Knowing this, I found by googling, that I can block referers by adding > this to my .htaccess file: > >> > >>RewriteEngine on > >>RewriteCond %{HTTP_REFERER} st\.ac\.th [NC,OR] > >>RewriteCond %{HTTP_REFERER} clubmedia-ent\.com [NC,OR] > >>RewriteCond %{HTTP_REFERER} multidicona\.com [NC] > >>RewriteRule ^ - [F] > >> > >> > >Your RewriteRule does not match any requests. Try > >RewriteRule .* - [F] > > > >After changing it, I did a "apachectl restart". > >> > >You do not need to restart after changing the htaccess. > > > > > Hi, after replacing the rule by your suggestion, I stopped checking my > error logs, until today. It seems the rule is not blocking the referers I > need to. > > This is an extract of the site-error_log of one site: > > [Sat Nov 05 21:11:05 2011] [error] [client 176.14.112.166] File does not > exist: /usr/local/www/apache22/data/site/gallery2, referer: > http://clubmedia-ent.com/film/contact.html > [Sat Nov 05 22:46:37 2011] [error] [client 95.27.181.153] File does not > exist: /usr/local/www/apache22/data/site/gallery2, referer: > http://multidicona.com/ > [Sun Nov 06 12:07:29 2011] [error] [client 95.26.196.133] File does not > exist: /usr/local/www/apache22/data/site/gallery2, referer: > http://multidicona.com/ > [Sun Nov 06 12:07:53 2011] [error] [client 95.25.98.97] File does not > exist: /usr/local/www/apache22/data/site/gallery2, referer: > http://www.multidicona.com/electronica.html > > I want to get rid of the attacks from "clubmedia-ent.com" and " > www.multidicona.com", how can I block these?. > > This is the .htaccess for the site: > > RewriteEngine on > RewriteCond %{HTTP_REFERER} st\.ac\.th [NC,OR] > RewriteCond %{HTTP_REFERER} clubmedia-ent\.com [NC,OR] > RewriteCond %{HTTP_REFERER} multidicona\.com [NC] > RewriteRule .* - [F] >
At a glance those look correct. This site has several examples: http://www.javascriptkit.com/howto/htaccess14.shtml If you have access to the vhost config to turn on RewriteLog, that might help you see why the pattern is not working.