Forum Discussion
HELP - Wildcard URI Redirect
HTTP::uri ALWAYS starts with / so your code should read:
if {[string tolower [HTTP::uri]] starts_with "/products/new/"- ekaleidoSep 07, 2016
Cirrus
Also, if you just want to replicate whatever comes after new/ you are not going to get away with just doing a redirect. You're going to have to capture everything after new/ to a variable to insert in the redirect.
- Will_Caetano_97Sep 07, 2016
Nimbostratus
Thank you for the feedback. Would you have any example on how to capture everything after new/. Sorry I'm really new to iRules.
- ekaleidoSep 07, 2016
Cirrus
I was afraid you'd ask. My TCL-fu sucks but this might be one way... 🙂
set firstUri [HTTP::uri] set newUri [split $firstUri "/"] foreach field $newUri { lassign $newUri field1 field2 field3 fieldHOWEVERMANYFIELDSYOUHAVE }Then in the redirect instead of /* it would be /$field1/$field2 etc, etc.
Like I said, my TCL-fu stinks, but someone will probably provide a more efficient answer.
- Will_Caetano_97Sep 07, 2016
Nimbostratus
thank you. I'll try playing around with that for awhile. Like you said maybe someone else already has a answer.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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