Forum Discussion

Shannon_Ryan_83's avatar
Shannon_Ryan_83
Icon for Nimbostratus rankNimbostratus
Dec 10, 2005

Simple url redirection not working (ssl)

Trying to redirect a request to the root of a webserver to a folder. Example, user types https://www.aaa.com and i want to redirect to https://www.aaa.com/bbb.

 

 

when HTTP_REQUEST {

 

if { not [HTTP::uri] contains "/bbb"} {

 

HTTP::redirect "https://www.aaa.com/bbb" }

 

}

 

 

Is the https my problem?

 

 

Thanks.

3 Replies

  • problem solved... does anyone see any problems with this:

     

    when HTTP_REQUEST {

     

    if { [HTTP::host] equals "www.aaa.com" } {

     

    if { [HTTP::uri] equals "" or [HTTP::uri] equals "/" } {

     

    HTTP::uri "/bbb" }

     

    }}

     

     

     

    Thanks.
  • Do you want an actual redirect response to be sent to the browser?

     

     

    Thanks,

     

    Brian

     

     

    P.S. - Check out this wiki, it has a redirect example: http://www.vj.com/f5 Click here
  • It depends on how your virtual is set up. If you have only port 80 set up on your virtual, then the https will be problematic if you haven't also set up a port 443 virtual on the same host. The redirection rule I use for clients that submit only the host or the host with the trailing slash is:

    
    when HTTP_REQUEST {
     if { ([ string length [HTTP::uri] ] <= 1) } {
       HTTP::redirect https://[HTTP::host]/bbb
     }
    }