Forum Discussion
reldar_76465
Jul 13, 2011Nimbostratus
redirect mobile devices
Hi,
I'm looking for a script that will enable us to redirect all traffic coming from mobile devices to a mobile site.
Many thanks for the help.
Roy
- hooleylistCirrostratusHi Roy,
- reldar_76465NimbostratusMany thanks for your reply.
- Michael_YatesNimbostratusHi reldar,
when HTTP_REQUEST { switch -glob [string tolower [HTTP::header User-Agent]] { "*blackberry*" - "*ipad*" - { log local0. "Device Access Attempt [HTTP::header User-Agent]" HTTP::redirect "http://m.mysite.com/[HTTP::uri]" return } } }
- Colin_Walker_12Historic F5 AccountI tend to agree with Michael about it being a chore and a half to maintain these lists. That being said, here's the logic you were asking for, which is a reverse of what you already have:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::header User-Agent]] { "*blackberry*" - "*ipad*" { } default { HTTP::redirect "http://mysite.com/[HTTP::uri]" } } }
- reldar_76465NimbostratusMany thanks again for your replies.
- Michael_YatesNimbostratusThere was no process handling for the event in Colin's post and there was a rogue "-" in mine.
when HTTP_REQUEST { switch -glob [string tolower [HTTP::header User-Agent]] { "*blackberry*" - "*ipad*" { HTTP::redirect "http://m.mysite.com/[HTTP::uri]" return } default { log local0. "Device Access Attempt [HTTP::header User-Agent]" } } }
- hooleylistCirrostratusOne tiny suggestion:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::header User-Agent]] { "*blackberry*" - "*ipad*" { HTTP::redirect "http://m.mysite.com[HTTP::uri]" } default { log local0. "Device Access Attempt [HTTP::header User-Agent]" } } }
- Mario_Eury_6049NimbostratusMike,
- Michael_YatesNimbostratusHi Mario Eury,
- Mario_Eury_6049NimbostratusMichael,
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects