Forum Discussion
I need an iRule that will search the HTTP::path for "/en/' change it to "/en-us/" and leave the rest of the path, query string intact
I need an iRule that will search the HTTP::path for "/en/' change it to "/en-us/" and leave the rest of the path, query string intact.
I have tried.
when HTTP_REQUEST { if { [string tolower [HTTP::path]] contains "/en/" } { HTTP::redirect "http://[HTTP::host]/en-us/[HTTP::query]" } }
and it just repeats/en-us/en-us/...then puts/en/?query string
I also tried
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/en/"}{ HTTP::respond 302 noserver Location "http://[HTTP::host][string map {en en-us} [HTTP::uri]]" } }
Neither one is working for me.
I am trying to temporarily bandage an issue that was created by a culture change in an application. The application used to accept /en/ as a culture and marketing has sent out hundred of links that use /en/ but the application was changed to no longer accept /en/ soi they asked me to change /en/ to /en-us/
Any advice or help would be appreciated.
Thanks John
2 Replies
- Kevin_Stewart
Employee
Try this:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/en/" } { set uri [string map -nocase {"/en/" "/en-us/"} [HTTP::uri]] HTTP::redirect "http://[HTTP::host]${uri}" } } - jcline
Nimbostratus
Works perfect.
Thank You!
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