Forum Moderators: phranque

Message Too Old, No Replies

Deny and Redirect Anonymouse site users

mod_rewrite rule help quested with referer

         

GeekInAsia

1:22 pm on Feb 16, 2010 (gmt 0)

10+ Year Member



I am trying to find a reliable method to stop people using an anonymizer site from user my site.

I thought it should be easy with mod_rewrite but for some reason I just can't get it to work and hoping someone would be kind enough to help me out. My current code it

# Deny Access to site from anonymous proxies based on Referer.
<IfModule mod_rewrite.c>
RewriteEngine On
# Check the referer for sitename.
RewriteCond %{HTTP_REFERER} ^http://Anonymouse\.org [NC]
# Redirect client to google
RewriteRule (.*) http://www.google.com [L]
</IfModule>


Thanks in advance for any help provided.

jdMorgan

4:54 pm on Feb 16, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your code should work, although it will invoke a 302 redirect not a 301, there's no need for the parentheses around the RewriteRule pattern since it is neither quantified nor back-referenced, and the target URL should end with a slash.

But why are you using the <IfModule> container? Are you installing this on several servers, some without mod_rewrite support on which you want it to fail silently?

Are you flushing your browser cache before testing new code, and when switching from proxied to non-proxied testing?

"It doesn't work" tells us nothing. How, specifically, does it not work? How are you testing? What happens? What doesn't happen? How do these differ from your expectations? Anything in the server error log?

Jim