Hi all,
I’ve got a URL like this:
http://www.domain.com/folder/recent\_main\_stuff/list/2?ts=1
I need to chop off everything after the ?, and make it like:
http://www.domain.com/folder/recent\_main\_stuff/list/2
Any help would be much appreciated. Thanks!
Hi,
Are you trying to redirect based on the “?” OR are you trying to remove everything after the “?” before it’s passed to the web server?
CB
remove everything after the ? before its passed to the web server.
So then, would this work:
when HTTP_REQUEST {
HTTP::redirect “http://[HTTP::host][HTTP::path]”
}
Well, by itself that would cause an infinite loop of redirects. You’ll probably want to add an if statement there to make sure you only redirect when you want to (when the URI contains a “?”).
Something like this would work
when HTTP_REQUEST {
if { [HTTP::uri] contains “?” ] } {
HTTP::redirect “http://[HTTP::host][HTTP::path]”
}
}
Otherwise, why return a redirect? JJust changing the uri for all further processing would have a similar effect without the user seeing any action.
That would require a rule like
when HTTP_REQUEST {
HTTP::uri “[HTTP::path]”
}
Well, I guess that would depend on if you want the query params dropped from the client’s point of view, or just the server’s.