Forum Discussion

Sean_M__85845's avatar
Icon for Nimbostratus rankNimbostratus
Dec 14, 2011

Performing a Redirect with URL Variables

I am trying to create an iRule that will perform a redirect using information within the original URL and creating a redirect with that information. Here's and example of what it would look like:



Original URL's:






New URL:



Basically I need to look for either the "nodeid" or "objid" in the original URL and use that same ID in the new URL as the "migrationID". Any suggestions on what the iRule would look like?

3 Replies

  • Hi Sean,



    You can parse the value of nodeid, objid or any other URI parameter using [URI::query [HTTP::uri] $parameter_name]:





    Are there specific URIs you want to check for redirecting? If so you can use a switch statement to check the URI:





  • Hi Sean M.

    Sure, you can do that using URI::query and specifying the parameter.

    Here is an example:

    when HTTP_REQUEST {
    if { [HTTP::uri] contains "nodeid" } {
    HTTP::redirect "[URI::query [HTTP::uri] nodeid]"
    if { [HTTP::uri] contains "objid" } {
    HTTP::redirect "[URI::query [HTTP::uri] objid]"

    Hope this helps.
  • Michael-


    Your example worked perfectly! Thanks for the assitance guys - I really apprecitate the help!