Forum Discussion
Multiple http_request iRules not working Same Virtual server
Hi iyyappan321,
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "energy.com" } {
HTTP::respond 301 Location "https://www.[HTTP::host][HTTP::uri]" "Connection" "Close"
return
} elseif { [string tolower [HTTP::host]] equals "corporate.ndtv.com" } {
HTTP::respond 301 Location "https://www.ndtv.com" "Connection" "Close"
return
}
}
switch version
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"energy.com" {
HTTP::respond 301 Location "https://www.[HTTP::host][HTTP::uri]" "Connection" "Close"
return
}
"corporate.ndtv.com" {
HTTP::respond 301 Location "https://www.ndtv.com" "Connection" "Close"
return
}
}
}
- Yesh1923Jan 17, 2023Nimbostratus
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] equals "energy.com")
HTTP::respond 301 location "https://www.[HTTP::host][HTTP::uri]" Connection Close
}
}when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] equals "corporate.ndtv.com")} {
HTTP::respond 301 location "https://www.ndtv.com" Connection Close
}
}when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"exxonmobil.eu" {
HTTP::respond 301 Location "https://www.[HTTP::host][HTTP::uri]" "Connection" "Close"
return
}
"corporate.exxonmobil.com.qa" {
HTTP::respond 301 Location "https://www.exxonmobil.com.qa" "Connection" "Close"
return
}
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "energy.com" } {
HTTP::respond 301 Location "https://www.[HTTP::host][HTTP::uri]" "Connection" "Close"
return
} elseif { [string tolower [HTTP::host]] equals "corporate.ndtv.com" } {
HTTP::respond 301 Location "https://www.ndtv.com" "Connection" "Close"
return
}
}much appreciate your response
one more info need - syntax for add more url
how to add these website as well -- goodenergy.com, oddenergy.com etc ... in below
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "energy.com" } {
HTTP::respond 301 Location "https://www.[HTTP::host][HTTP::uri]" "Connection" "Close"
return&
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"energy.com" {
HTTP::respond 301 Location "https://www.[HTTP::host][HTTP::uri]" "Connection" "Close"
return>>>>>>>>>>>>
how add multi sites in below syntax
marketing.ndtv.com" as well"corporate.ndtv.com" {
HTTP::respond 301 Location "https://www.ndtv.com" "Connection" "Close"
return- Jan 17, 2023
when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "energy.com" - "goodenergy.com" - "oddenergy.com" { HTTP::respond 301 Location "https://www.[HTTP::host][HTTP::uri]" "Connection" "Close" return } "corporate.ndtv.com" - "marketing.ndtv.com" { HTTP::respond 301 Location "https://www.ndtv.com" "Connection" "Close" return } } }
You can review the article at the link for switch command usage.
- Yesh1923Jan 17, 2023Nimbostratus
hi enes
i will test this rule will come back if faced any issue
thanks agian for your support !!!!!!
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