4 Replies Latest reply on Feb 12, 2009 4:29 AM by jfclere

    Rewrite  url, http code 302 instead of 301.

    jadtn

      Hi,
      I want to move permanently some page and domain.
      When i look http header it's http code 302
      So i specified 301, here the rewrite.properties under /conf/


      RewriteRule ^/?pages/pub/typerencontres/([a-z/.]+)$ /$1 [R=301,L]
      RewriteRule ^/?pages/pub/typerencontres/([a-z/.]+)$ /$1 [R=301,L]
      RewriteRule ^/?pub/html/partenaires.jsf$ /pages/pub/annuaire-rencontres.jsf [R=301,L]
      RewriteCond %{HTTP_HOST} ^www.a.fr [NC]
      RewriteRule ^(.*) http://www.a.com$1 [R=301,L]


      What s wrong?
      I use jboss 4.2.2 / jsf
      Thanks

        • 1. Re: Rewrite  url, http code 302 instead of 301.-->It s seem
          jadtn

          Hi
          The problem seem to be a bug see at the end.
          But now how can I have a jbossweb-extras.jar (probabably another jar org/apache/catalina has modification for the patch) for jboss 4.2.x?
          I m trying in jboss 4.2.3, jboss 5 GA and the problem exists always.
          The jbossweb-extras.jar from jbossweb 1.0 and 2 don't work.

          I've trying to do my redirect in a servlet but some files are not in war but in deploy/stats.war/ and this is not hanle by the servlet.

          Thanks for your help.

          https://jira.jboss.org/jira/browse/JBWEB-67

          I'm providing this patch which fixes the following issues with the rewrite valve and makes it's behavior more consistent with mod_rewrite.
          1: Rewrite conditions were not being processed
          2: Case insensitive pattern matches were not working
          3: Send redirect with an arbitrary code now works and uses reflection to see if the method is available so the valve will still work with standalone tomcat
          4: Patterns are no longer forced to match the whole input for conditions and rules
          5: The server variable HTTP_HOST included the port if the server wasn't running on the standard ones (80/443)
          6: QSA is how handled and query strings are appended where appropriate
          7: Comments are now allowed in the rewrite.properties file


          • 2. Re: Rewrite  url, http code 302 instead of 301.
            jfclere

            4.3.x and 4.2.x doesn't contain the patch of JBWEB-67.
            5.x should work.

            • 3. Re: Rewrite  url, http code 302 instead of 301.
              jadtn

              I've tested with lastest jboss 5.0.0.GA
              And it returns always code 302. : HTTP/1.x 302 D�plac� Temporairement

              • 4. Re: Rewrite  url, http code 302 instead of 301.
                jfclere

                Ok I fixed it in JBoss WEB trunk.