Forum Discussion
obartek_169898
May 28, 2015Nimbostratus
iRule with regex, change string inside URI for another one
Hello,
I want to redirect ( http 301) this request
domain.com/pl/_company-id/SOME_DIGITS
New request should look like this:
domain.com/_company-id/SOME_DIGITS/?language_code
REGEX
domain.com/pl/_company-id/(\d+)
domain.com/_company-id/$1/?language_code
So I need to match SOME_DIGITS string and put it after new URI + put another sting later
Should I change SOME_DIGITS to variable and use it later ? How can I do it ?
I've no idea how to achive this goal, please help if anyone knows.
best regards
when HTTP_REQUEST { if {[string tolower [HTTP::uri]] matches_regex {/pl/_company-id/\d+} } { HTTP::redirect "/_company-id/[string range [HTTP::uri] [string last / [HTTP::uri]] end]/?language_code" } }
- Josiah_39459Historic F5 Account
when HTTP_REQUEST { if {[string tolower [HTTP::uri]] matches_regex {/pl/_company-id/\d+} } { HTTP::redirect "/_company-id/[string range [HTTP::uri] [string last / [HTTP::uri]] end]/?language_code" } }
- obartek_169898Nimbostratus
Works perfect !
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