Forum Discussion
Drew_123833
Nimbostratus
Mar 23, 2015Redirect full website
Hello everyone I'm trying to redirect my website www.company.com to a sorry page. Due to a database maintenance. I did the redirection through an irule. So far so good. The basic irule to red...
Hannes_Rapp
Nimbostratus
Mar 23, 2015Perhaps there are other redirect iRules which take precedence over your maintenance redirect? You could try using the priority function and see whether it resolves your issue.
priority 10
when HTTP_REQUEST {
if { [HTTP::host] == "www.company.com" } {
HTTP::respond 302 location "http://sorry.company.com"
event disable
TCP::close
}
}
Note: The code above would work only if the maintenance page is not served by the same Virtual Server (listener). If the maintenance page is served via the same Virtual Server, you'll have to add a negative condition to avoid a redirect loop:
priority 10
when HTTP_REQUEST {
if { (([HTTP::host] == "www.company.com") && not([HTTP::path] == "/maintenance")) } {
HTTP::respond 302 location "http://www.company.com/maintenance"
event disable
TCP::close
}
}
Good luck 😉
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