Forum Discussion

hkr_36676's avatar
hkr_36676
Icon for Nimbostratus rankNimbostratus
Jan 13, 2008

Rewrite long-uri to short-uri........

Hi.

 

 

I am trying to rewrite a uri which is quite long.

 

 

1

 

Request from client:

 

http://www.mysite.com/SHORT/Start/$first?opendocument&Expand=1

 

The request to the server should be rewritten to:

 

http://www.mysite.com/ndk_website/seminar/proweb25/cmsdoc.nsf/Start/$first?

 

 

2

 

Furthermore any reference in the returning page should be rewritten to http://www.mysite.com/SHORT/Start/$first?.

 

 

I have managed to find a solution for the 2:

 

when HTTP_RESPONSE {

 

if {[HTTP::header value Content-Type] contains "text"}{

 

STREAM::expression "@/ndk_website/seminar/proweb25/cmsdoc.nsf/@/SHORT/@"

 

STREAM::enable

 

}}

 

 

To add it up I want the client to use a SHORT uri and

 

the server a LONG uri.

 

 

 

/Hallur

 

 

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hello,

     

     

    If you start with a request from the client:

     

    /SHORT/Start/$first?opendocument&Expand=1

     

     

    And want to rewrite it to:

     

    /ndk_website/seminar/proweb25/cmsdoc.nsf/Start/$first?

     

     

    You can use something like this:

     

     

    HTTP::uri [string map {/SHORT /ndk_website/seminar/proweb25/cmsdoc.nsf}]

     

     

    This will replace the string /SHORT with the /ndk_website...cmsdoc.nsf string.

     

     

    Do you need to change the parameters in the query string?

     

     

    Aaron