Forum Discussion
kc2kth_49679
Nimbostratus
Feb 06, 2009Rewrite host and URI, then redirect
I thought I was pretty close on this one, but I can't quite get it to work. I need to rewrite a portion of a URI (drop part of the path and change the name of the page), change the host name, t...
kc2kth_49679
Nimbostratus
Feb 06, 2009Thanks Aaron. I did need to change the redirect again though to get it working. Something closer to my final is below. It looks like the cached URI was being passed in your example instead of what I thought I was updating with the string map. Changing that line a bit allowed me to change the redirect to reference the two variables instead.
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"app.domain.com" {
set host "www.google.com"
set uri [string map -nocase {"/path_to_replace" "/new_path" "index.jsp" "index.asp"} [HTTP::uri]]
HTTP::redirect http://$host$uri
}
}
}
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