Forum Discussion
Multiple http_request iRules not working Same Virtual server
Hi iyyappan321,
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] equals "essar.com") && (([string tolower [HTTP::path]] eq "/en") or ([string tolower [HTTP::path]] eq "/en/")) } {
HTTP::respond 301 Location "https://essar.com/en-gb/"
return
} elseif { ([string tolower [HTTP::host]] equals "essar.com") && ([string tolower [HTTP::path]] contains "/wholesale-fuels") } {
HTTP::respond 301 Location "https://www.essar.com/wholesale-fuels" "Connection" "Close"
return
}
else {
HTTP::respond 301 Location "https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
TCP::close
}
}
You need to use this iRule in non 443 virtual server. Otherwise, redirect loop occurs.
hi enes thanks for your response
i used below rule , but i can able to access only - energy.com site , if i access essar.com its not getting redirect to "https://corporate.essar.com/fr-fr"
my requirement is i want to access both - energy.com , if i access essar.com -- have to redirect to "https://corporate.essar.com/fr-fr"
please help
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] equals "essar.co.uk") && (([string tolower [HTTP::path]] eq "/en") or ([string tolower [HTTP::path]] eq "/en/")) } {
HTTP::respond 301 location "https://wholesalefuels.essar.co.uk/en-gb/"
}
elseif { ([string tolower [HTTP::host]] equals "energy.com") } {
HTTP::respond 301 location "https://www.energy.com" Connection Close
}
elseif { ([string tolower [HTTP::host]] equals "essar.com") && ([string tolower [HTTP::path]] contains "fr-fr/wholesale-fuels") } {
HTTP::respond 301 location "https://www.essar.com/fr-FR/wholesale-fuels"
}
elseif { ([string tolower [HTTP::host]] equals "www.essar.com") && ([HTTP::path] eq "/") } {
HTTP::respond 301 location "https://corporate.essar.com/fr-fr"
}
else {
HTTP::respond 301 "Location" "https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
}
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