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
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