Forum Moderators: phranque

Message Too Old, No Replies

IP exception to UA

         

wilderness

3:03 pm on Dec 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Jim or another,

Would the following be the correct procedure for a IP exception to a UA denial?

#deny UA with the exception of IP range
RewriteCond %{REMOTE_ADDR} ^123\.456\.789\.
RewriteCond %{HTTP_USER_AGENT} keyword
RewriteRule .* - [F]

thanks in advance.

Don

jdMorgan

3:09 pm on Dec 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That would only deny if both the IP address and the UA matched. You need to negate the IP address with a "!" -- That is, "Deny this UA if IP address is NOT 123.45.67.89"

Jim

wilderness

3:13 pm on Dec 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Had it in there and omitted it when making afjustments ;)

Thus the following would be correct?

#deny UA with the exception of IP range
RewriteCond %{REMOTE_ADDR}!123\.456\.789\.
RewriteCond %{HTTP_USER_AGENT} keyword
RewriteRule .* - [F]

or
#deny UA with the exception of IP range
RewriteCond %{REMOTE_ADDR}!^123\.456\.789\.
RewriteCond %{HTTP_USER_AGENT} keyword
RewriteRule .* - [F]

jdMorgan

3:17 pm on Dec 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use the second version if the IP address starts with "123."

Jim

wilderness

3:20 pm on Dec 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Many thanks Jim.

Don