Probably very basic problkem, but can't figure it out

View: New views
3 Messages — Rating Filter:   Alert me  

Probably very basic problkem, but can't figure it out

by elpatator-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi all,

i'm trying to rewrite urls using this wonderful, yet obscure for me
filter.
I'm using struts actions, so here's what worked for me from now on:
In order not to change all urls in my site , I did for example

<rule>
            <from>/actions/home</from>
            <to type="redirect">/home.html</to>
        </rule>
        <rule>
            <from>/home.html</from>
            <to>/actions/home</to>
        </rule>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "UrlRewrite" group.
To post to this group, send email to urlrewrite@...
To unsubscribe from this group, send email to urlrewrite+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/urlrewrite?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Probably very basic problkem, but can't figure it out

by elpatator-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi all,

i'm trying to rewrite urls using this wonderful, yet obscure for me
filter.
I'm using struts actions, so here's what worked for me from now on:
In order not to change all urls in my site , I did for example

<rule>
            <from>/actions/home</from>
            <to type="redirect">/home.html</to>
        </rule>
        <rule>
            <from>/home.html</from>
            <to>/actions/home</to>
        </rule>
This works very well, I get the right well written urls in the url
bar, while struts still finds out how to treat "/actions/home".
My problem is, while using this filter with dynamic varibles
containing url, I just can't get my varibales back on the tracks.
I tryied :

        <rule>
            <from>^/actions/afficherArticleParVitrineReference?
referenceVitrine=([A-Z]+)$</from>
            <to type="redirect">/offre/$1.html</to>
        </rule>
        <rule>
            <from>/offre/([A-Z]+).html</from>
            <to>/actions/afficherArticleParVitrineReference?referenceVitrine=
$1</to>
        </rule>
but strangely, this doesn't work. Where did I go wrong ?
Thanks a lot.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "UrlRewrite" group.
To post to this group, send email to urlrewrite@...
To unsubscribe from this group, send email to urlrewrite+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/urlrewrite?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Probably very basic problkem, but can't figure it out

by Avlesh Singh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The problem is with your regular expression in the rules. The characters question-mark (?), period (.) etc are regex special characters and hold a different meaning altogether.

Changing the rule
^/actions/afficherArticleParVitrineReference?referenceVitrine=([A-Z]+)$
to
^/actions/afficherArticleParVitrineReference\?referenceVitrine=([A-Z]+)$
should work as expected.

Similarly, changing the rule
/offre/([A-Z]+).html
to
/offre/([A-Z]+)\.html
should work as expected.

Don't forget to add "use-query-string=true" to your root node for #1 to work properly.

Cheers
Avlesh

On Fri, Sep 25, 2009 at 7:39 PM, elpatator <romain.simiand@...> wrote:

Hi all,

i'm trying to rewrite urls using this wonderful, yet obscure for me
filter.
I'm using struts actions, so here's what worked for me from now on:
In order not to change all urls in my site , I did for example

<rule>
           <from>/actions/home</from>
           <to type="redirect">/home.html</to>
       </rule>
       <rule>
           <from>/home.html</from>
           <to>/actions/home</to>
       </rule>
This works very well, I get the right well written urls in the url
bar, while struts still finds out how to treat "/actions/home".
My problem is, while using this filter with dynamic varibles
containing url, I just can't get my varibales back on the tracks.
I tryied :

       <rule>
           <from>^/actions/afficherArticleParVitrineReference?
referenceVitrine=([A-Z]+)$</from>
           <to type="redirect">/offre/$1.html</to>
       </rule>
       <rule>
           <from>/offre/([A-Z]+).html</from>
           <to>/actions/afficherArticleParVitrineReference?referenceVitrine=
$1</to>
       </rule>
but strangely, this doesn't work. Where did I go wrong ?
Thanks a lot.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "UrlRewrite" group.
To post to this group, send email to urlrewrite@...
To unsubscribe from this group, send email to urlrewrite+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/urlrewrite?hl=en
-~----------~----~----~----~------~----~------~--~---