Forum Discussion

OCC_68606's avatar
OCC_68606
Icon for Nimbostratus rankNimbostratus
Jun 14, 2011

iRule Redirect Mobile Site

I have this iRule to identify mobile browser, for example apple devices:

 

 

 

 

 

when HTTP_REQUEST {

 

if { [string tolower [HTTP::host]] contains "www.mainsite.com" } {

 

switch -glob [string tolower [HTTP::header User-Agent]] {

 

"*iphone*" -

 

"*ipod*" -

 

"*ipad*" {

 

HTTP::redirect "http://mobilesite.com[HTTP::uri]"

 

return

 

}

 

}

 

}

 

}

 

 

 

mobilesite.com has a link to www.mainsite.com (In case you don´t like be in mobile site)

 

 

 

I want to do something that manage if you are in mobile site and you want to go to main site the iRule does not enter in a loop.

 

 

 

Any ideas??

 

 

 

Jorge.

 

17 Replies