Forum Discussion

Joe_Pipitone's avatar
Joe_Pipitone
Icon for Nimbostratus rankNimbostratus
Feb 09, 2010

Rewriting and passing query string only, not uri

I currently have an iRule that does a rewrite and also passes the uri.

I want to ONLY catch the query string and not the uri - for example:

http://www.oursite.org/info.aspx?id=67727

should redirect to:

http://info.oursite.com/default.aspx?id=67727

therefore stripping the info.aspx and only passing the query string - is this possible? This is the iRule I currently have in place which passes the uri, but this is incorrect. Thanks for any help.

 
 when HTTP_REQUEST {   
     switch [string tolower [HTTP::path]] {   
       "/info.aspx" {   
         HTTP::redirect "http://info.oursite.com/default.aspx[HTTP::uri]"   
       }    
     }   
   } 
 

1 Reply

  • Hi Joe,

     

     

    You can retrieve the query string (uri minus the path) using HTTP::query. For your iRule, just replace [HTTP::uri] with ?[HTTP::query].

     

     

    HTTP::redirect "http://info.oursite.com/default.aspx?[HTTP::query]"

     

     

    Aaron