Forum Discussion
Damien_Turner_1
Nimbostratus
Aug 02, 2010Redirect if your a mobile user....
Hi all, I was wondering if I could have some help!
I have been asked if it is possible to use an iRule to redirect a mobile user to a new URL.
An example would be....
user on an iPhone goes to www.m...
Chris_Miller
Altostratus
Aug 02, 2010Damien,
The first thing you need to do is implement the logic for your rule to detect whether the user is an iPhone. For this, you'll use the HTTP::header command to query the "User-Agent" header.
http://devcentral.f5.com/wiki/default.aspx/iRules/HTTP__header.html
You'll do an iRule like this and put it on your www.mysite.com VIP
when HTTP_REQUEST {
if { [HTTP::header "User-Agent"] contains "iPhone"] } {
HTTP::redirect "http://m.mysite.com" }
}
When you want to do more than just iPhones, you'll want to create a "datagroup" which contains all types of phones and reference that instead of just the string "iPhone"
Shall I assume the VIP to which m.mysite.com points has a pool of web servers setup to render mobile-specific content?
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
