Forum Discussion
bd94_306725
Altostratus
Oct 06, 2017Irule Regular expression for HTTP redirect
Hello,
i've got a lot of domain like country.mydomain.com
When users write , they are redirect to fr.mydomain.com. To do that i'm using this iRule :
when HTTP_REQUEST {
set host [strin...
Stanislas_Piro2
Cumulonimbus
Oct 06, 2017you can try something like that
switch -glob -- [set host [HTTP::host]] {
"www.*.domain.com" { HTTP::respond 301 noserver Location "https://[getfield $host "." 2].domain.com${uri}"}
"www.domain.co.*" { HTTP::respond 301 noserver Location "https://[getfield $host "." 4].domain.com${uri}"}
"www.domain.*" { HTTP::respond 301 noserver Location "https://[getfield $host "." 3].domain.com${uri}"}
}
Note: Edited to correct getfield command
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