Forum Discussion
Alexander_Slink
Altostratus
Aug 01, 2016Change only first slash in URI.
Hello everyone!
I want change only first slash in uri on a some word.
i.e.: http://example.com/test/picture.jpg
And after change URI must be http://example.com/after_change/test/picture.jpg
I've tried to do with iRule:
when HTTP_REQUEST {
log local0. "Incoming URI = [HTTP::uri]"
if { [string tolower [HTTP::uri]] starts_with "/" } {
set uri [string map -nocase {"/" "/after_change/"} [HTTP::uri]]
log local0. "New URI = $uri"
HTTP::uri $uri
}
}
But this iRule change all slashes in URI:
http://example.com/after_change/test/after_change/picture.jpg
Help needed!
1 Reply
Hi Alexander,
to add a fixed subfolder to every URI, you may want to try the syntax below...
when HTTP_REQUEST { log local0. "Incoming URI = [HTTP::uri]" HTTP::uri "/after_change$uri" log local0. "Outgoing URI = [HTTP::uri]" }Cheers, Kai
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
