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.

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