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, ...
nitass
Dec 08, 2011Employee
can 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
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