Forum Discussion

mguned_60772's avatar
mguned_60772
Icon for Nimbostratus rankNimbostratus
Dec 18, 2009

URI - Rewrite - Redirect?

Is there a way to grab part of the URI and insert into the redirected URL?

 

 

Example:

 

 

redirect http://domain.com/bookstore/detail.asp?sku=xxxx (extract xxxx)

 

 

to http://newdomain.com/(insert xxxx).aspx

 

 

I have never had to do something this complex before....any help is much appreciated!

 

2 Replies

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    Absolutely.

     

     

    You can grab the parameter provided to the URI using the 'URI::query ' command. So something like

     

     

    set extract [URI::query [HTTP::query] "sku" ]

     

     

    will set the variabe $extract to the value passed in the sku parameter. Then simply include the variable in the redirect command. e.g.

     

     

    HTTP::redirect "http://newdomaind.com/$extract.aspx"

     

     

    H