Forum Discussion
Joseph_Johnson_
Feb 27, 2015Nimbostratus
iRule redirect to mobile site
Hi,
I'm trying to create an iRule that will redirect users to site "www.mobilesite.com/slm/faces/m/index.jspx" if on mobile device else redirect to "https://mysite.com/OLA/faces/siteLocator.jspx"....
Michael_Jenkins
Feb 27, 2015Cirrostratus
I think with your iRule, you'll wind up in an endless loop for mobile clients unless you add a URI check for the redirect page. And I'm assuming that if the user agent isn't for a mobile client, you want to redirect them to the page you mentioned... Maybe something like this would work
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] contains "www.mobilesite.com"}{
switch -glob [string tolower [HTTP::header User-Agent]] {
"*ipad*" -
"*iphone*" -
"*android*" -
"*windows phone*" -
"*windows ce*" -
"*bada*" -
"*bb10*" -
"*blackberry*" -
"*symbinos*" -
"*symbain os*" -
"*symbian*" -
"*java*" -
"*winowsphone*" -
"*windowsce*" {
if {not ([string tolower [HTTP::uri]] equals "/slm/faces/m/index.jspx")} {
HTTP::redirect "www.mobilesite.com/slm/faces/m/index.jspx"
return
}
}
default {
HTTP::redirect "https://mysite.com/OLA/faces/siteLocator.jspx"
}
}
}
}
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