Forum Discussion
dcam_21053
Nimbostratus
Sep 17, 2012URL Redirect Not Working
I am not sure why, but can someone look at this redirect irule and tell me what I am doing wrong. It is a seemingly simple thing. I am seeing that the irule is being hit, no errors, and the VIP is being hit of course, but there is no redirect happening. It keeps sending me to the original site.
when HTTP_REQUEST {
if { [HTTP::uri] equals "site/care/ccso" } {
HTTP::uri "http://site/sites/ccsops/"
}
}
6 Replies
- Kevin_Stewart
Employee
a URI will always starts with "/". Also assuming "site" is you host name. So:when HTTP_REQUEST { if { [HTTP::uri] equals "/care/ccso" } { HTTP::uri "/sites/ccsops" } }
Also remember that HTTP::uri will transparently redirect the URI. The user won't see this in the browser. If you want something more explicit, try HTTP::redirect "http://site/sites/ccsops/". - dcam_21053
Nimbostratus
I tried it the way you suggested and it still not doing a redirect. - Kevin_Stewart
Employee
Okay, do this:when HTTP_REQUEST { log local0. "URI = [HTTP::uri]" if { [HTTP::uri] starts_with "/care/ccso" } { HTTP::uri "/sites/ccsops/" } }
I added a logger line. View that either through the LTM log in the management UI or by tailing the /var/log/ltm file in the shell. I also change the HTTP::uri conditional to "starts_with" instead of "equals" on the hunch that your URI isn't exactly what you're looking for.
Now, do you want the browser to explicitly redirect to the new URI, or do you want the browser's address bar to same the same but still go to this new URI? - dcam_21053
Nimbostratus
I would like the browser to explicitly redirect to the new URI....
I should have mentioned this before, not sure if it matters though. The site is actually going to Sharepoint...the url hits the site and the content is fetched from a database. - dcam_21053
Nimbostratus
Thank you, with your help I was able to get it to work...it is now redirecting properly. I ended up using the operator "contains" - scottwilliem_12
Nimbostratus
Want some more details about this is not working if we putted it properly....
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
