Forum Discussion

Jeff_Denny_2552's avatar
Jeff_Denny_2552
Icon for Nimbostratus rankNimbostratus
Mar 23, 2016

irule for lower case of uri

Dear Members,

 

I have below mentioned code for which there is one confusion to implement the code for lower case. Issue is i need to redirect entire url / uri or query with lower case letter. e.g if someone types MyLocalNet.Net/Fr/PaGes/Default it should be lower case mylocalnet.net/fr/pages/default etc. Appreciate your support. Thanks.

 

when HTTP_REQUEST { / tell server not to compress response

 

/ HTTP::header remove Accept-Encoding

 

/ disable STREAM for request flow

 

STREAM::disable

 

/ redirect discnet requests to discnet site

 

if { [string tolower [HTTP::path]] equals "/" } {

 

        if { [HTTP::header "Accept-Language"] starts_with "fr" } {
            HTTP::respond 301 "Location" "https://www.mylocalnet.net/fr/pages/default.aspx"

} elseif { [HTTP::header "Accept-Language"] starts_with "en" } { HTTP::respond 301 "Location" "https://www.mylocalnet.net/en/pages/default.aspx" } } elseif { [string tolower [HTTP::path]] equals "/discnet/discnet.xml" } { HTTP::respond 301 "Location" "https://discnet.mylocalnet.net/discnet/discnet.xml"

 

} elseif { [HTTP::path] contains "/sub-catagories/" } { HTTP::respond 301 noserver Location "https://[HTTP::host][string map -nocase {sub-catagories sub-catagaries} [HTTP::path]]"

 

} elseif { [HTTP::path] contains "/health-blog/" } { HTTP::respond 301 noserver Location "https://[HTTP::host][string map -nocase {net-blog net-let} [HTTP::path]]"

 

} elseif { [string tolower [HTTP::uri]] equals "/en/testing.xml" } { HTTP::uri "/en-testing.xml" } elseif { [string tolower [HTTP::path]] equals "/fr/testing.xml" } { HTTP::uri "/fr-testing.xml"

 

} }

 

7 Replies