Forum Moderators: phranque

Message Too Old, No Replies

Ban Referrer Part 2

         

frontpage

9:13 pm on Feb 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I followed the recommendations provided in an earlier thread to ban pron referrers.

The format of the referrer that I wish to ban is

keyword1-keyword2.blogspot.com

( the format is keyword1 followed by a hypen the keyword2 followed by ".blogspot.com".)

I tried the following in my mod_rewrite enabled .htaccess without success:

1)

RewriteCond %{HTTP_REFERER} ^http://(www\.)?([a-z0-9\-]+)\.blogspot\.com(/)? [NC] 

2)

RewriteCond %{HTTP_REFERER} ^http://.*blogspot\.com [NC,OR] 

The rule is: RewriteRule .* - [F,L]

Is there an alternate format for banning blogspot domains beside those listed above beside IP banning?

I don't wish to change my website and let these spammers win!

jdMorgan

10:19 pm on Feb 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



frontpage,

As was noted in the previous thread, you can return a 403-Forbidden response to these requests, but you cannot "disconnect" them completely from your server unless you use a firewall configured to do so.

The proper form for the code would be:


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://.*blogspot\.com [NC]
RewriteRule .* - [F]

Note that the [OR] flag has been removed from the RewriteCond, since there are no more subsequent RewriteConds. The Options +FollowSymLinks and RewriteEngine on directives are needed only once, at the top of your file. You may not need the Options +FollowSymLinks at all -- this depends on your server configuration.

If you have created a custom 403 error document, then that page will need to be excluded from the above rewrite. For example, if you called it 403.html, then you could exclude it by changing the rule to

RewriteRule !^403\.html$ - [F] 

If that code setup does not return a 403-Forbidden response to requests referred by bl0gsp0t, then you have some other problem preventing mod_rewrite from working.

Jim