Forum Discussion
Need to replace middle of URL
I need to replace the middle of this url and some others.
http://test.host.com/Library/content/en/Integrators-v1/GUID-7CDA266F-3924-4B28-A026-3092CDB17E7B
Needs to be
http://test.host.com/Library/content/en/product-v2/GUID-7CDA266F-3924-4B28-A026-3092CDB17E7B
I'm using this code and its not firing.
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/library/content/en/integrators-v1/" { set newURI [string map -nocase {"/Library/content/en/Integrators-v1/" "/Library/content/en/product-v2/"} [HTTP::uri]] log local0. "redirecting to http://[HTTP::host]$newURI" HTTP::redirect "http://[HTTP::host]$newURI" } } }
1 Reply
- Kevin_Stewart
Employee
You're missing the wildcard on the end of your URI evaluation:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/library/content/en/integrators-v1/*" { set newURI [string map -nocase {"/Library/content/en/Integrators-v1/" "/Library/content/en/product-v2/"} [HTTP::uri]] log local0. "redirecting to http://[HTTP::host]$newURI" HTTP::redirect "http://[HTTP::host]$newURI" } } }
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