0 Replies Latest reply on Oct 28, 2011 6:10 PM by Carlos Oliva

    Proper format for redirect condition

    Carlos Oliva Novice

      Sould the condition of a rewrite be added as an attribute or an element?  I am trying to redirect http to https.  In JBoss5, I could add a condition to the rewrite.properties files and identify the requests that were http instead of https.  I could use sentences that were vey similar to apache rewrites. I am unsure as to how one would insert the condition in the redirect element because the documentation seems to imply that the condition is an attribute of the redirect element.  The documentation also states that the condition has attributes also.

       

      JBoss 5 -- This works

      RewriteCond %{HTTPS} off

      RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301]

       

      JBoss 7 -- Is this correct?  It never rewrites to https

      <rewrite pattern=".*" substitute="https://%{SERVER_NAME}%{REQUEST_URI}" flags="R">

      <condition pattern="%{HTTPS}" test="!=on" flags="NC" />

      </rewrite>