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
Colin_Walker_12
Jul 20, 2011Historic F5 Account
I 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]"
}
}
}
Basically all you need to do is make the cascading list of fall-through logic end with something other than the redirect. It could be sending the request to a pool or simply doing nothing, as above. Then everything that doesn't match one of those cases, which are the mobile cases, will fall through to the redirect and get sent to your non mobile site.
Colin
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