Forum Discussion

ashok_65614's avatar
ashok_65614
Icon for Nimbostratus rankNimbostratus
Mar 11, 2010

irule for URI

 

URL : www.test.com/abc/test/login

 

 

I need to match the condition as below

 

 

If my host = test.com & uri starts with /abc

 

 

then the below url only should work

 

 

"www.test.com/abc/test/login "

 

 

else page not found.

 

 

Note: This should not affect rest or the URI in the host.

 

 

 

Can any one provide the iRule for implementing this.

1 Reply

  • Maybe something like this?

     
     when HTTP_REQUEST { 
      
         Check host is www.test.com 
        if {[string tolower [HTTP::host]] eq "www.test.com"}{ 
      
            Check if URI starts with /abc 
           if {[HTTP::uri] starts_with "/abc"}{ 
      
               Check if URI is not exactly "/abc/test/login" 
              if {[HTTP::uri] ne  "/abc/test/login"}{ 
      
                  Send a 404 response 
                 HTTP::respond 404 content {not found} 
              } 
           } 
        } 
     } 
     

    Aaron