Forum Discussion
roostar_79107
Nimbostratus
Jul 02, 2009regex irule for search url redirect
Any one got a sample irule that will identify a search term (in this case the word 'help') and rewrite the url using the search term?
e.g.
http://www.mycompany.com/forum/s...
Jul 02, 2009
Ryan, a couple of questions come up.
1) Are you merely looking to search for something in the URI or is there another search source?
2) Do you want to issue a browser redirect (so the address bar on the browser get's updated) or do you want to transparently change the host and URI before it hits the server? Since you are redirecting to google.com I'm assuming you don't own google on your backend so you are looking for a browser redirect, but thought I'd ask.
If you are just looking in the URI, you can do something like this:
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"*help" {
transform url.
}
}
} For the transforming, if you want to issue a HTTP redirect, you can do so like this:
HTTP::redirect "http://www.google.com/search?q=help site:mycompany.com/forum" If you want to transparently change the host and URI, here's how:
HTTP::Header replace "Host" "www.google.com"
HTTP::URI "http://www.google.com/search?q=help site:mycompany.com/forum" Hope this helps...
-Joe
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
