adding new rule for agent; not working as expected
2 posts
• Page 1 of 1
- birdiealuap
- Posts: 4
- Joined: 22 Apr 2013, 14:51
adding new rule for agent; not working as expected
My RewriteCond is working for the REMOTE_ADDR header; it catches the ipaddresses from multiple regex expressions and redirects them correctly:
RewriteCond %{REMOTE_ADDR} (\b101\.\d{1,3}\.\d{1,3}\.\d{1,3}|^\b199\.30\.16\.23|\b46\.119\.\d{1,3}\.\d{1,3})
RewriteRule (.*) http\://www.asdf.com/CASP_BotCatch.aspx\?htaccess=1&agentblock=0&ipblock=1 [I,RP]
Now I want to add a new rule that catches agents that are really bots. I have added this rule:
Here is the agent string: "Java/1.6.0_04"
RewriteCond User-Agent: .*Java.*
RewriteRule (.*) http\://www.asdf.com/CASP_BotCatch.aspx\?htaccess=1&agentblock=1&ipblock=0 [I,RP]
This worked on my local box, but on the shared box, it does not. I initially tried this:
RewriteCond User-Agent: .*Java.*
RewriteCond %{HTTP_USER_AGENT} (*.Java.*)
RewriteRule (.*) http\://www.asdf.com/CASP_BotCatch.aspx\?htaccess=1&agentblock=1&ipblock=0 [I,RP]
But this did not work on either my local box or my shared host.
Can someone help me out with this? Many thanks
RewriteCond %{REMOTE_ADDR} (\b101\.\d{1,3}\.\d{1,3}\.\d{1,3}|^\b199\.30\.16\.23|\b46\.119\.\d{1,3}\.\d{1,3})
RewriteRule (.*) http\://www.asdf.com/CASP_BotCatch.aspx\?htaccess=1&agentblock=0&ipblock=1 [I,RP]
Now I want to add a new rule that catches agents that are really bots. I have added this rule:
Here is the agent string: "Java/1.6.0_04"
RewriteCond User-Agent: .*Java.*
RewriteRule (.*) http\://www.asdf.com/CASP_BotCatch.aspx\?htaccess=1&agentblock=1&ipblock=0 [I,RP]
This worked on my local box, but on the shared box, it does not. I initially tried this:
RewriteCond User-Agent: .*Java.*
RewriteCond %{HTTP_USER_AGENT} (*.Java.*)
RewriteRule (.*) http\://www.asdf.com/CASP_BotCatch.aspx\?htaccess=1&agentblock=1&ipblock=0 [I,RP]
But this did not work on either my local box or my shared host.
Can someone help me out with this? Many thanks
Re: adding new rule for agent; not working as expected
This rule seems to be correct
RewriteCond User-Agent: .*Java.*
RewriteRule (.*) http\://www.asdf.com/CASP_BotCatch.aspx\?htaccess=1&agentblock=1&ipblock=0 [I,RP]
Please double check that your production server reload config correctly
Try to add simple test rule
RewriteRule testtest - [G]
And request this url twice.
RewriteCond User-Agent: .*Java.*
RewriteRule (.*) http\://www.asdf.com/CASP_BotCatch.aspx\?htaccess=1&agentblock=1&ipblock=0 [I,RP]
Please double check that your production server reload config correctly
Try to add simple test rule
RewriteRule testtest - [G]
And request this url twice.
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests