Forum Discussion
winifred_corbet
Nimbostratus
Jun 14, 2007Simple redirect for home page only
I need to redirect anyone coming in to http://www.somedomain.com to http://www.somedomain.com/cda/homepage.do in the meantime anyone coming in on http://www.somedomain.com/anydirectory still gets to t...
hoolio
Cirrostratus
Jun 14, 2007I assume you just want to redirect based on the URI in the request and not the host. Here's an example that will send a redirect for / to /cda/homepage.do. All other requests will be unchanged.
when HTTP_REQUEST {
if {[HTTP::path] eq "/"}{
log local0. "redirecting client [IP::client_addr]"
HTTP::redirect http://[HTTP::host]/cda/homepage.do
}
}If you have more tests you want to perform, you could use a switch statement to do the comparisons. Check the wiki page for switch (Click here) for details.
Also, if you're on version 9.4.0, you can use an HTTP class to issue redirects. Create an HTTP class with a path of "/" and change the 'send to' option to 'redirect to' http://[HTTP::host]/cda/homepage.do.
Holler if you have any questions.
Aaron
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
