Forum Discussion

abdullah_alshah's avatar
abdullah_alshah
Icon for Nimbostratus rankNimbostratus
Jan 07, 2018

blocking uri

hi, i need to block all uri on the website with below iRule but not working fine:

 

when HTTP_REQUEST { if { [string tolower [HTTP::host]] contains "; and ($uri contains "/")} { HTTP::redirect ";

 

}

 

}

 

please help me.

 

5 Replies

  • Try using the following:

     when HTTP_REQUEST {
     if { ([string tolower [HTTP::host]] contains "www.example.com") 
          && ( [string tolower [HTTP::uri]] contains "/") }
     {
     HTTP::redirect https://www.test.com
     }
     }
    
  • Try using the following:

     when HTTP_REQUEST {
     if { ([string tolower [HTTP::host]] contains "www.example.com") 
          && ( [string tolower [HTTP::uri]] contains "/") }
     {
     HTTP::redirect https://www.test.com
     }
     }
    
  • URI condition is useless as / is in every requests.

     

    try this code

     

     when HTTP_REQUEST {
         if { [string tolower [HTTP::host]] equals "www.example.com"} {
            HTTP::redirect https://www.test.com
         }
     }