Forum Discussion

Deepak_Muvvala1's avatar
Deepak_Muvvala1
Icon for Nimbostratus rankNimbostratus
Mar 27, 2009

Redirection

Hi,

 

 

This is what I would like to achieve using a i-Rule

 

 

when the user types

 

http://x.x.x.x/despense/conical/index.asp

 

to be re-drirected/re-written to

 

http://x.x.x.x/Sample/despense/conical/index.asp

 

 

I would just like to insert the word "Sample"

 

 

And I have my i-Rule written like this

 

 

when HTTP_REQUEST {

 

HTTP::redirect "http://[HTTP::host]/Sample[HTTP::uri]"

 

}

 

 

This is not working. Any idea?

2 Replies

  • That would loop until the browser or user gives up. You can add a check to see if the path already starts with /Sample before redirecting:

     
     when HTTP_REQUEST { 
      
         Redirect client if request doesn't start with sample 
        if {not ([HTTP::path] starts_with "sample")}{ 
      
            Redirect 
           HTTP::redirect "http://[HTTP::host]/sample[HTTP::uri]" 
        } 
     } 
     

    Aaron