Domai
Sep 27, 2017Altostratus
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.