Forum Discussion
Dayton_Gray_103
Nimbostratus
Sep 20, 2007Change URI parameters with a 301 redirect
I am looking to change a URI to remove certain query string parameters and redirect with a 301.
Example:
Incoming URI
www.example.com/example.jsp?zoneId=624906&zz=2255956&parentPage=exa...
Dayton_Gray_103
Nimbostratus
Sep 22, 2007Joe,
Thanks for the response this is exactly what I was looking for. I seem to have gotten myself into a redirect loop however. Can you suggest how I can resolve this? As you can see I have been trying to get out of it by setting a header and then checking for that header's existence, but it doesn't seem to be working:
when HTTP_REQUEST {
if { [HTTP::header exists "LastHop"] } {
return 0
}
else
{
if { [HTTP::path] contains "/zone/" } {
set zoneid [findstr [HTTP::uri] "zoneId=" 0 "&"]
if { [string length $zoneid] > 0 } {
HTTP::header insert LastHop 1
HTTP::respond 301 Location "http://[HTTP::host][HTTP::path]?$zoneid"
}
}
}
}
Thank you for the help!
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