Forum Discussion

Bob_10976's avatar
Icon for Nimbostratus rankNimbostratus
Jun 07, 2012

Odd WWW Redirect and Uppercase issue..

Hello all, I've got an odd issue with one redirect not working and it seems because the URI has uppercase in it.I have a couple of redirect in place which is below but the problem is if I go to it won't redirect however if I use it will.

This is www redirect rule:

switch "[string tolower [HTTP::host]]" { {
HTTP::respond 301 Location "[HTTP::uri]"

This is the specific section of URI redirect rule:

elseif { [string tolower [HTTP::uri]] starts_with "/portal/orglist.aspx" } {
     HTTP::respond 301 Location

I even tried changing the "starts_with" to Equals but didn't change anything, and I attempted to remove the [string tolower... section but I get an error indictating that is not a vaild rule.

Any suggestions or thoughts on what I'm doing wrong?



2 Replies

  • Hi Bob,

    From what you are describing it should work properly. Thing that I can notice from what you have provided is that your "" is not enclosed in "".

    Try something like this:

    when HTTP_REQUEST {
    switch [string tolower [HTTP::host]] {
    "" { 
    if { [string tolower  [HTTP::uri]] ends_with "/portal/orglist.aspx" } {
    log local0. "Qualified Match: [HTTP::uri]"
    HTTP::respond 301 Location ""

    These were my logged results:

    Jun 7 13:29:06 local/tmm info tmm[30731]: Rule Z.iRule.Development : Qualified Match: /Portal/ORGList.aspx

    Hope this helps.
  • Arie's avatar
    Icon for Altostratus rankAltostratus
    Your snippet contains "elseif". Is it possible that there's another condition that is being met earlier in the code?