Forum Discussion
iRule help to retain URI and update hostname
Hello Guys, I am trying to come up with an irule to accomplish the following.
http://oldjunk.com/cat/site/default.asp and http://oldjunk.com/cat should be redirected to new page called
But the catch is if a user bookmarked the the old site url with the uri for example
http://oldjunk.com/cat/mmm/cwp/view.asp?a=3483&Q=413540&dcfNav=
it should replace host name and retain the uri
http://oldjunk.com/cat/mmm/cwp/view.asp?a=3483&Q=413540&dcfNav=
with
This is what I came up with so far -
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] eq "oldjunk.com") and ([string tolower [HTTP::uri]] eq "/cat") } {
HTTP::redirect "http://newupdatedsite/cat"
}
elseif { ([string tolower [HTTP::host]] eq "oldjunk.com") and ([string tolower [HTTP::uri]] eq "/cat/site/default.asp") } {
HTTP::redirect "http://newupdatedsite/cat"
}
}
I am not able to understand how I can get the second part in. I would appreciate any elegant approach suggestions or examples.
- P_K
Altostratus
Did you try replacing the hostname in the header like below ??
when HTTP_REQUEST {
Recent Discussions
Related Content
* 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