Forum Moderators: phranque

Message Too Old, No Replies

Redirecting to mobile site

Less 1 directory

         

gniver

7:31 pm on Aug 15, 2011 (gmt 0)

10+ Year Member



Hi,

I'm redirecting phone browsers to mobile web version:

...
RewriteCond %{HTTP_USER_AGENT} "android" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "AvantGo" [NC]
RewriteRule (/example.*) /mobile/#_example [NE,R,L]

I need to exclude 1 directory from the rule so that /example/1directory/ doesn't redirect to the mobile site. I have tried a few ways which haven't worked. How can I configure this?

Thank you.

lucy24

10:45 pm on Aug 15, 2011 (gmt 0)

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



Add the directory to your list of Conditions as a negative. Yes, that was a deliberately fuzzy answer ;) The next person to respond to this thread will play Good Cop.

Um, yes, come to think of it I guess that would only work if you changed your present [OR] structure to a single pipe-delimited list. But you'll want to do that anyway. Saves time and space. It is theoretically possible to combine [OR] with the default AND in lists of Conditions, but you do so at your own peril.

gniver

4:38 pm on Aug 16, 2011 (gmt 0)

10+ Year Member



Thanks lucy24. I got it.

wilderness

4:56 pm on Aug 16, 2011 (gmt 0)

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



Add the directory to your list of Conditions as a negative.

<snip>

come to think of it I guess that would only work if you changed your present [OR] structure to a single pipe-delimited list


It will function either way.

lucy24

10:45 pm on Aug 16, 2011 (gmt 0)

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



It will function either way.

User-agent Android (et cetera) OR (separate line) request not for Unchanging Directory?

This is why I don't have a lot of OR. It makes me dizzy :(

:: wandering off to Apache to see if they've got a disquisition on combining AND with OR without benefit of parentheses ::