Forum Moderators: phranque

Message Too Old, No Replies

.htaccess and UA

why doesn't this code work?

         

oracle3410

2:29 am on Jul 30, 2007 (gmt 0)

10+ Year Member



Why does this .htaccess

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} .*InfoPath\.2\)$
RewriteRule ^.* - [F]

Not match the following UA?

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2)

jdMorgan

3:43 am on Jul 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It does match. Did you clear your browser cache completely before testing?

Jim

wilderness

1:15 pm on Jul 30, 2007 (gmt 0)

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



Why does this .htaccess

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} .*InfoPath\.2\)$
RewriteRule ^.* - [F]

Not match the following UA?

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2)

I'm not sure why you need the leading ".*" in the second line?
It just makes Apache do excess processing!
"ends with Infopath.2 is both sufficient and clean.

The escape character \ for the ending parentheses ) is NOT required, whether it would stop the line from working, I'm unable to answer.

Don