Forum Discussion
Mark_58017
Nimbostratus
Aug 01, 2013URI rewrite based upon regex
Hi,
I have a number of URI rewrites to do and I've done most of them. However, this one has me stumped.
rewrite url="~/jewelry/(.+)/(.+)" to="~/jewelry/?collection=$1&product=$2" processing="stop" /
Any help would be appreciated.
Thanks Mark.
2 Replies
- nitass
Employee
not sure if i understand regex correctly. 🙂[root@ve10:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if { [scan [HTTP::uri] {/jewelry/%[^/]/%s} one two] == 2 } { HTTP::uri "/jewelry?collection=${one}&product=${two}" } } } [root@ve10:Active] config ssldump -Aed -nni 0.0 port 80 New TCP connection 1: 172.28.20.17(50672) <-> 172.28.19.252(80) 1375355678.8878 (0.0013) C>S --------------------------------------------------------------- GET /jewelry/foo/bar HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.252 Accept: */* --------------------------------------------------------------- New TCP connection 2: 200.200.200.10(50672) <-> 200.200.200.101(80) 1375355678.8925 (0.0027) C>S --------------------------------------------------------------- GET /jewelry?collection=foo&product=bar HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: 172.28.19.252 Accept: */* --------------------------------------------------------------- - Mark_58017
Nimbostratus
Awesome, thanks for that.
Been digging around for the correct syntax for regex for iRules but couldn't get my head around the examples I saw.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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