Forum Discussion
aschi
Nimbostratus
Mar 13, 2013Just Part of the url tolower
Hi
I searched the web and forum on ho to change some parts ot the url but wasn't successfull.
I need a iRule that just changes the bold part in the following examples.
www.domain.ch/URI1/(S(o5f...
nitass
Employee
Mar 13, 2013do you want to lower whole HTTP::path string (e.g. /myDirectory/Index.html) or only the first directory (e.g. /myDirectory/)?
whole HTTP::path string
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if { [HTTP::query] ne "" } {
HTTP::redirect " tolower [HTTP::path]]?[HTTP::query]"
} else {
HTTP::redirect " tolower [HTTP::path]]"
}
}
}
[root@ve10:Active] config curl -I 'http://www.example.com/myDirectory/Index.html?Param1=Value1&Param2=Value2'
HTTP/1.0 302 Found
Location: http://www.example.com/mydirectory/...am2=Value2
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
the first directory
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if { [scan [HTTP::path] {/%[^/]} str] == 1 } {
HTTP::redirect " map [list /${str}/ /[string tolower $str]/] [HTTP::uri]]"
}
}
}
[root@ve10:Active] config curl -I 'http://www.example.com/myDirectory/Index.html?Param1=Value1&Param2=Value2'
HTTP/1.0 302 Found
Location: http://www.example.com/mydirectory/...am2=Value2
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
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