Forum Discussion

aguley_212957's avatar
aguley_212957
Icon for Nimbostratus rankNimbostratus
Nov 17, 2015

iRule Redirect

I am very new to iRules. I have the first portion of my rule working correctly   when HTTP_REQUEST {   if {[HTTP::path] eq "/"}{ HTTP::redirect "/ABC/" } }   I also want to add to t...
  • Brad_Parker_139's avatar
    Nov 17, 2015

    Give this a try. Essentially if the path doesn't start with /abc redirect it permanently to https://mysite.com/abc/.

    when HTTP_REQUEST {
        if { not ([string tolower [HTTP::path]] starts_with "/abc") }{
            HTTP::respond 301 noserver Location "https://mysite.com/abc/"
        }
    }