Forum Discussion
Clayton_Wagner_
Nimbostratus
Jan 16, 2013Base Domain Redirect with user-agent detection
I have the rule below in place and it works, but I have to create a seperate irule for every domain I host. I'm trying to create a single rule that I can use on all of my digital properties. The requ...
nitass
Employee
Jan 16, 2013is this useful?
[root@ve10:Active] config b rule myrule list
rule myrule {
when RULE_INIT {
set domain_list { domain.com www.domain.com shop.domain.com }
foreach domain $domain_list {
set last [string last . $domain end]
set sec [string last . $domain [expr {$last-1}]]
log local0. "domain: $domain | base domain: [string range $domain [expr {$sec+1}] end]"
}
}
}
[root@ve10:Active] config tail -f /var/log/ltm
Jan 17 15:54:51 local/ve10 err mcpd[3776]: 01020066:3: The requested rule (myrule) already exists in partition Common.
Jan 17 15:54:51 local/tmm info tmm[4884]: Rule myrule : domain: domain.com | base domain: domain.com
Jan 17 15:54:51 local/tmm info tmm[4884]: Rule myrule : domain: www.domain.com | base domain: domain.com
Jan 17 15:54:51 local/tmm info tmm[4884]: Rule myrule : domain: shop.domain.com | base domain: domain.com
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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