Forum Discussion
isavic
Nimbostratus
Sep 29, 2020Redirect for URL and URI in one Irule
I need to redirect one url called usparks.something.ca to https://something.ca/attractions.php and at same time usparks.something.ca/fr to https://something.ca/fr/attractions.php. My Irule looks like...
Sep 29, 2020
Hi Igor,
You should add HTTP::uri equals "/" comparison. If not add, always "if statement" will run.
when HTTP_REQUEST {
if { [HTTP::host] equals "usparks.something.ca" } {
if { [HTTP::uri] equals "/" } {
HTTP::redirect "https://something.ca/attractions.php"
}
elseif { [string tolower [HTTP::uri]] equals "/fr" } {
HTTP::redirect "https://something.ca/fr/attractions.php"
}
}
}or
when HTTP_REQUEST {
if { [HTTP::host] equals "usparks.something.ca" } {
switch [string tolower [HTTP::uri]] {
"/" { HTTP::redirect "https://something.ca/attractions.php" }
"/fr" { HTTP::redirect "https://something.ca/fr/attractions.php" }
}
}
}Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
