2 Replies Latest reply on Oct 14, 2008 7:10 AM by stephanos

    URLRewrite & redirect issue

    stephanos

      Hi,


      I use URLRewrite in order to rewrite


      test.com/home.seam?lang=en&ctry=gb



      to


      test.com/en/gb/home



      This works perfectly fine with h:commandLinks and h:outputLinks. But as soon as I have a redirect from pages.xml like


      <redirect view-id="/home.xhtml" />



      It ends up not being rewritten and shows up with URL parameters :-(


      How to solve that??


      Cheers,
      Stephen

        • 1. Re: URLRewrite & redirect issue
          norman

          What are your rewrite patterns and what URL are you getting that isn't being rewritten?

          • 2. Re: URLRewrite & redirect issue
            stephanos

            Well the relevant patterns are these (since this is about outgoing URLs only those are printed):


               <!-- direct access -->
                <outbound-rule>  
                     <from>^/(\w*).seam\?lang=(\w\w)&amp;ctry=(\w\w)$</from>  
                     <to last="true">%{context-path}/%{session-attribute:language}/%{session-attribute:country}/$1</to>  
                </outbound-rule>
                 
                <outbound-rule>  
                     <from>^/(\w*).seam\?lang=(\w\w)&amp;ctry=(\w\w)&amp;(.*)$</from>  
                     <to last="true">%{context-path}/%{session-attribute:language}/%{session-attribute:country}/$1?$4</to>  
                </outbound-rule>
                 
                <outbound-rule>  
                     <from>^/(\w*).seam$</from>  
                     <to last="true">%{context-path}/%{session-attribute:language}/%{session-attribute:country}/$1</to>  
                </outbound-rule>
                 
                <outbound-rule>  
                     <from>^/(\w*).seam\?(.*)$</from>  
                     <to last="true">%{context-path}/%{session-attribute:language}/%{session-attribute:country}/$1?$2</to>  
                </outbound-rule>
            



            which works on every h:outputLink request, like the following.


            <a jsfc="h:outputLink" id="homeLink" value="/home.seam">
               <span>Home</span>
            </a>




            I also tested this successfully with TestNG.


            However, despite the test results, after redirecting in pages.xml with


            <redirect view-id="/home.xhtml" />



            the following URL appears:


            /home.seam?lang=de&ctry=de




            So it seems to me that URL rewriting is not applied when redirecting, which seems odd.