Forum Discussion
gcaba_31903
Dec 08, 2011Nimbostratus
simple irule that does host redirect with wildcard
hi,
i'm in the process of retiring a domain and all websites behind it, so I need to redirect all of them to a new domain.
- so far I got this rule working, see code below,
when HTTP_REQUEST {
if {[HTTP::host] contains www.abc.com}
{HTTP::redirect "HTTP://www.cde.com[HTTP::uri]"}
elseif {[HTTP::host] equals "abc.com"}
{HTTP::redirect }
}
but given the amount of sites I would like to make more general and use a wild card
when HTTP_REQUEST {
if {[HTTP::host] contains *.abc.com}
{HTTP::redirect }
}
thanks,
but given the amount of sites I would like to make more general and use a wild card
- nitassEmployeecan you try this?
[root@ve1023:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve1023:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if {[string tolower [HTTP::host]] ends_with "abc.com"} { HTTP::redirect "http://www.cde.com[HTTP::uri]" } } } [root@ve1023:Active] config curl -I http://abc.com HTTP/1.0 302 Found Location: http://www.cde.com/ Server: BigIP Connection: Keep-Alive Content-Length: 0 [root@ve1023:Active] config curl -I http://www.abc.com HTTP/1.0 302 Found Location: http://www.cde.com/ Server: BigIP Connection: Keep-Alive Content-Length: 0 [root@ve1023:Active] config curl -I http://whatever.abc.com HTTP/1.0 302 Found Location: http://www.cde.com/ Server: BigIP Connection: Keep-Alive Content-Length: 0
- gcaba_31903Nimbostratusnitass,
- gcaba_31903Nimbostratusnitass,
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