Forum Discussion
gr0x_33657
Nimbostratus
Nov 03, 2009URI Redirect
Hi,
We would like to redirect all traffic to our maintenance page, so far if someone calls the domain name for example "www.domainname.com" the irule works and redirects the person to "...
The_Bhattman
Nimbostratus
Nov 03, 2009This is because the you have [HTTP::path] equal "/" which means that it will only redirect when there is no URI in the domain.
For example this will redirect to maintenance if it matches 2 conditions
when HTTP_REQUEST {
if { ([HTTP::host] eq "www.domainname.com") and ([HTTP::path] eq "/" } {
HTTP::redirect "http://[HTTP::host]/maintenance.html"
}
}
If you want it to match on "/sitefolder" and "/"then you can do the following
when HTTP_REQUEST {
if {[HTTP::host] eq "www.domainname.com") } {
switch -glob [HTTP::path] {
"/" { HTTP::redirect "/maintenance.html" }
"/sitefolder" { HTTP::redirect "/maintenance.html" }
}
}
}
You can keep expanding to other URIs as well
I hope this helps
CB
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
