Forum Discussion
nitass
Nov 01, 2012Employee
as nathan mentioned, i just removed "https://" from Steve's irule. additionally, since you do string tolower twice, you had better save it to variable and re-use it.
when HTTP_REQUEST {
set wap "https://wapsite.com/uri"
set normal "https://normal.com/uri"
set smart "https://smartphonesite.com/uri"
if { [HTTP::host] equals "mysite.com" } {
set user_agent [string tolower [HTTP::header User-Agent]]
if { [class match -- $user_agent contains user_agent_tokens_class] } {
log local0. "wap phone"
HTTP::redirect $wap
} elseif { [class match -- $user_agent contains mobile_device_providers] } {
log local0. "smart phone"
HTTP::redirect $smart
} else {
log local0. "Normal web site"
HTTP::redirect $normal
}
}
}