Forum Discussion
collinz1_17223
Jul 14, 2011Nimbostratus
iRule Redirect Loop
I have setup an irule that checks the user agent string when http requests are made. If the user agent is a mobile type device (as defined in a data group) they get redirected to the mobile site. ...
Colin_Walker_12
Jul 14, 2011Historic F5 Account
Try this:
when HTTP_REQUEST {
if {([class match [string tolower [HTTP::header User-Agent]] contains "mobiledevices"]) && !([string tolower [HTTP::uri]] starts_with "/mobile")} {
HTTP::redirect "http://[HTTP::host]/mobile"}
}
The && !() statement is the important one here. You're basically saying only redirect to /mobile if the inbound user is a mobile device that isn't already on the mobile portion of the 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