Forum Discussion
dacrud_18985
Nimbostratus
Jun 04, 2008chop off question mark
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!
6 Replies
- The_Bhattman
Nimbostratus
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 - dacrud_18985
Nimbostratus
remove everything after the ? before its passed to the web server. - dacrud_18985
Nimbostratus
So then, would this work:
when HTTP_REQUEST {
HTTP::redirect "http://[HTTP::host][HTTP::path]"
} - Andy_Herrman_22
Nimbostratus
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 "?"). - Robert_Sutcliff
Nimbostratus
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]"
} - Andy_Herrman_22
Nimbostratus
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.
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