Forum Discussion
Daniel_S_135288
Mar 18, 2015Nimbostratus
match_regex redirect
Hello Guys
Im need your help
I try to redirect a URI with a dynamic Number
my iRule looks like this at the moment
if { [HTTP::uri] matches_regex {/c/cn[0-9]{5}} } {
H...
Michael_Jenkins
Mar 18, 2015Cirrostratus
If you want to use regex, you can do something like this:
Match the "/cn/" and grab the (the "0" is so the regexp can send the full string to null instead of an actual variable since you don't need it)
[regexp -nocase {/cn(\d+)/} $a 0 id]
$id will be 75470 in your examples case
if { [info exists id] && $id } {
HTTP::respond 301 Location https://www.abc.com/c/cn$id
return
}
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