Forum Discussion
Edu_50128
Apr 06, 2011Nimbostratus
URL redirect
Hello,
I´m new in iRules...
I need to configure F5 to redirect a URL... so it is, I need to redirect the traffic for the url www.mypage.com to www.newpage.com, but the last one is not on my network, it´s on a web hosting (first one yes).
I´ve thought this configuration:
when HTTP request {
if { [HTTP::host] equals "www.mypage.com"} {
HTTP: redirect "http://www.newpage.com"
}
}
Will it work? What dou you think?
Is there any other configuration better?
thanks
best regards
- Michael_YatesNimbostratusYes. That will work and result in a 302 Temporary Redirect.
when HTTP_REQUEST { if { [HTTP::host] equals "www.mypage.com" } { HTTP::respond 301 Location "http://www.newpage.com" } }
- Edu_50128NimbostratusThanks a lot !!!
- if you want a case insensitive match remember to use "string tolower"
- Michael_YatesNimbostratusThe [HTTP::host] portion of any URL should be auto case insensitive on any platform. Its the [HTTP::uri], [HTTP::path], or [HTTP::query] portions that are case sensitive.
- That will teach me to skim through a post on my phone, no uri in his post ;) Thanks for the catch.
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