Forum Moderators: phranque
Periodically my blog is linked in <objectionable> forums and I get abusive comments coming from specific threads at the site. I'd like to be able to ban anyone from commenting (or visiting?) who comes to my site from a specific url or domain. Let's say my commenter is coming to my post from www.exampleforum.com/discussions/thread.php?t=331697
I'd like to either be able to ban someone from that specific URL or else from the exampleforum.com domain.
I don't know the technical issues involved in this & perhaps it's not feasible. But it would sure work wonders for me in preventing blog assaults.
To be clear, I don't mean that I want to ban commenters who use a specific domain or url in their comment ID info. I want to somehow connect the URL or domain they CAME FROM to preventing a visit or comment.
To those who may suggest using blog comment moderation for this purpose, my settings are currently not working & I can't use them in this way (it's a long story).
I don't think you can do this w. cPanelx. I know you can deny access by IP. But I don't believe you can deny access by domain...or can you?
[edited by: jdMorgan at 1:18 pm (utc) on Aug. 22, 2005]
[edit reason] Removed specifics. [/edit]
RewriteCond %{HTTP_REFERER} example\.com [OR]
RewriteCond %{HTTP_REFERER} anotherdomain\.com
RewriteRule .* - [F] My question is--if unwanted visitors are coming from a specific thread within a forum site is there a way to be more specific in the domain ban. Instead of banning 'example.com' can I ban 'example.com/threads'?
The reason for my wanting to do this is that my abusive visitors are coming only from the forum portion of this site and I don't see a need (yet) to ban anyone from this entire site fr. visiting my blog.
[edited by: jdMorgan at 1:19 pm (utc) on Aug. 22, 2005]
[edit reason] examplified. [/edit]
My question is--if unwanted visitors are coming from a specific thread within a forum site is there a way to be more specific in the domain ban. Instead of banning 'example.com' can I ban 'example.com/threads'?
Yes, just add it onto the strings in the code you show above.
Escaping rules apply; You must escape characters which have special meanings to the regular-expressions parser by preceding them with a "\". In this case, you're likely to need to escape literal periods (as already shown above), and the "?" that separates any query strings from the URL if you are blocking from specific forums threads in a dynamically-generated forum.
RewriteCond %{HTTP_REFERER} exampleforum\.com/discussions/thread\.php\?t=331697
RewriteCond %{HTTP_REFERER} example\.com
RewriteRule .* - [F] or
Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} #*$!\.com
RewriteRule .* - [F] Also, when I add this rewrite rule then the domain forwarding mod_rewrite rules also in my .htaccess file stop working.
When I remove the domain banning code above, then everything goes back to normal. Can you think of how this may be causing a conflict & what I might do to resolve it?
Don't know if this has anything to do w. anything but I noticed that the .htaccess file commands have lost all formatting & they just run on w/o line breaks. Since the commands in the above code are formatted with line breaks could this be the problem or part of it?