Forum Discussion
nitass_89166
Noctilucent
can we just use split command and then concat whatever domain level you want?
e.g.
% set host www.google-analytics.com
www.google-analytics.com
% set lhost [split $host .]
www google-analytics com
% put [llength $lhost]
3
% put [lindex $lhost 0]
www
% put [lindex $lhost 1]
google-analytics
% put [lindex $lhost 2]
com
kullwahad_19151
Jun 11, 2015Nimbostratus
thanks to you, I managed to do it.
here for anyone for need it in a irule :
set host [string tolower [HTTP::host]]
set lhost [split $host .]
set nbrfield [llength $lhost]
set nbrendfiled [expr {$nbrfield - 1}]
set nbrdomainfiled [expr {$nbrfield - 2}]
set endfield [lindex $lhost $nbrendfiled]
set domainfield [lindex $lhost $nbrdomainfiled]
set endofhost "$domainfield.$endfield"
Thanks a lot !
Regards