Forum Moderators: phranque

Message Too Old, No Replies

.htaccess rewrite based on UA

Must be missing something

         

bcolflesh

1:52 am on Nov 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to rewrite based on a particular UA, ex:

Mozilla/3.0 (compatible; MSIE 5.0; Windows 5.0; QVC 1.0.0)

How do I add and delimit this line? - this doesn't work:

Mozilla/3.0\ (compatible;\ MSIE\ 5.0;\ Windows\ 5.0;\ QVC\ 1.0.0)

or this:

Mozilla/3\.0\ (compatible;\ MSIE\ 5\.0;\ Windows\ 5\.0;\ QVC\ 1\.0\.0)

Birdman

2:10 am on Nov 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Rewriting based on UA isn't a great idea, as far as I know but, you should only have to escape the periods(\.).

Let's see the rewrite

bcolflesh

2:13 am on Nov 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Snippet from larger file - you have to escape the spaces - escaping the periods has no effect either way for me.

RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4.0\ (compatible;\ MSIE\ 6.0;\ Windows\ NT\ 5.0;\ YPC\ 3.0.0) [OR]

jdMorgan

2:18 am on Nov 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You MUST escape the parentheses spaces, and periods, and may need to escape the semicolons as well.

bcolflesh

2:32 am on Nov 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It was the parenthesis - semicolon was fine - thanks jdMorgan!