Forum Discussion
reldar_76465
Nimbostratus
Jul 13, 2011redirect 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
- hoolio
Cirrostratus
Hi Roy, - reldar_76465
Nimbostratus
Many thanks for your reply. - Michael_Yates
Nimbostratus
Hi 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_76465
Nimbostratus
Many thanks again for your replies. - Michael_Yates
Nimbostratus
There 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]" } } }
- hoolio
Cirrostratus
One 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_6049
Nimbostratus
Mike, - Michael_Yates
Nimbostratus
Hi Mario Eury, - Mario_Eury_6049
Nimbostratus
Michael,
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