Forum Discussion

MikeM_44778's avatar
MikeM_44778
Icon for Nimbostratus rankNimbostratus
Feb 02, 2007

host redirect problem

I am trying to use a rule that will redirect anyone that hits http://www.testsite.com to redirect https://www.testsite.org

 

I have tried the following rule:

 

 

when HTTP_REQUEST {if {[HTTP::host] equals "www.testsite.com"} {HTTP::redirect "https://www.testsite.org"}}

 

 

followed by a second rule to ensure everyone hits HTTPS:

 

 

when HTTP_REQUEST { HTTP::redirect https://[HTTP::host][HTTP::uri] }

 

 

The second HTTP to HTTPS rule works great, but I need to either merge these two or ensure anyone that types www.testsite.com goes to our www.testsite.org website.
  • figured out the problem - I did need to merge the two as:

     

     

    when HTTP_REQUEST {if {[HTTP::host] equals "www.testsite.com"} {HTTP::redirect "https://www.testsite.org[HTTP::uri]"} else { HTTP::redirect https://[HTTP::host][HTTP::uri] }}