Hi Thicardoso21 ,
As Enes_Afsin_Al sent it will be sufficient for your request exactly.
> May I have understood your request in a different way , please correct for me , I think you need to change the old " Host name " FQDN each time regardless /content1/ exists on request or not.
so I have created and irule matchs your request , also it prevents the old Host name and refirect to the new hostname each time anyone put the old url.
So I wrote this iRule :
when HTTP_REQUEST {
if {(([string tolower [HTTP::host]] equals "mysite.com") ||([string tolower [HTTP::host]] equals "newsite.com")) and ([string tolower [HTTP::path]] starts_with "/content1")}{
HTTP::redirect https://newshopping.asm.f5/[string map {"/content1" "/"} [HTTP::path]]
} else {
if {(([string tolower [HTTP::host]] equals "mysite.com") and ([string tolower [HTTP::path]] starts_with "/"))}{
HTTP::redirect "https://newsite.com[HTTP::path]"
}
}
}
> I added this Part : ||([string tolower [HTTP::host]] equals "newshopping.asm.f5")
to eliminate any possibility to see " Content1 " with old or new hostname , I though that if you are redirected to the new web site " newsite.com" , and want to retrieve /Content1/anythingelse or Click on a button on new web page retieves directly /content1/anythingelse Resource , so it will appeare " newsite.com/content1/anythingelse" , So I have put this condition to eliminate the existance of /content1/ resource with old hostname and new as well.
> After " else " Statement , it is to redirect all requests to old host name to new host name regardless what are the rest of uri path.
you can remove it if you want to redirect old hostname to new hostname with only existance of /Content1/ resource path in Requests .
Regards