[?] get params to the url rewrite

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

[?] get params to the url rewrite

by Roublard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Guys, hi!

Have a problem here, kinda novice in url rewriting. Need a rewriting
rule from
/oc/TaskStart.do?method=selectTaskMethod&mid=91023909520346476
to
/methods/oc/91023909520346476

I've tried a lot of reqexps but still have no luck to create it. Could
you please provide me an example?

Looks like it could be simething like

    <rule>
        <name>redirect method selector</name>
        <from>^/oc/TaskStart.do?method=selectTaskMethod&mid=(.+)$</
from>
        <to type="permanent-redirect" last="true">/methods/oc/$1</to>
    </rule>

But it doesn't work of course :(

Thanks in advance!!!

--~--~---------~--~----~------------~-------~--~----~
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: [?] get params to the url rewrite

by Avlesh Singh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Have a problem here, kinda novice in url rewriting. Need a rewriting rule from /oc/TaskStart.do?method=selectTaskMethod&mid=91023909520346476 to /methods/oc/91023909520346476
Are you sure that you want it written that way? Use cases are generally the reverse!

Anways,

if your answer is yes -
<from>/oc/TaskStart.do\?method=selectTaskMethod&amp;mid=(.*)</from>
<to type="permanent-redirect" last="true">/methods/oc/$1</to>
Don't forget to turn on the "use-query-string" parameter in the root node.

if reverse if what you wanted to do -
<from>/methods/oc/(.*)</from>
<to type="permanent-redirect" last="true">/oc/TaskStart.do\?method=selectTaskMethod&amp;mid=$1</to>

Cheers
Avlesh

On Thu, Nov 5, 2009 at 1:58 PM, Roublard <alexey.petuhov@...> wrote:

Guys, hi!

Have a problem here, kinda novice in url rewriting. Need a rewriting
rule from
/oc/TaskStart.do?method=selectTaskMethod&mid=91023909520346476
to
/methods/oc/91023909520346476

I've tried a lot of reqexps but still have no luck to create it. Could
you please provide me an example?

Looks like it could be simething like

   <rule>
       <name>redirect method selector</name>
       <from>^/oc/TaskStart.do?method=selectTaskMethod&mid=(.+)$</
from>
       <to type="permanent-redirect" last="true">/methods/oc/$1</to>
   </rule>

But it doesn't work of course :(

Thanks in advance!!!




--~--~---------~--~----~------------~-------~--~----~
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: get params to the url rewrite

by baby-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

I am new to URL re-writing. I have the same question. How can i pass
the query parameters to the actual URL

e.g. Here is my rule

<rule>
    <from>^/([A-Za-z0-9]+)$</from>
    <to>/test.do?id=$1</to>
</rule>

now when user provide the URL like : http://localhost:8080/test/prodcut001?code=001&name=test
then how can i pass "code=001&name=test" in the actual URL i.e. /
test.do?id=product001&code=001&name=test

Thanks,
Baby

On Nov 6, 7:17 am, Avlesh Singh <avl...@...> wrote:

> > Have a problem here, kinda novice in url rewriting. Need a rewriting rule
> > from /oc/TaskStart.do?method=selectTaskMethod&mid=91023909520346476 to
> > /methods/oc/91023909520346476
>
> Are you sure that you want it written that way? Use cases are generally the
> reverse!
>
> Anways,
>
> if your answer is yes -
> <from>/oc/TaskStart.do\?method=selectTaskMethod&mid=(.*)</from>
> <to type="permanent-redirect" last="true">/methods/oc/$1</to>
> Don't forget to turn on the "use-query-string" parameter in the root node.
>
> if reverse if what you wanted to do -
> <from>/methods/oc/(.*)</from>
> <to type="permanent-redirect"
> last="true">/oc/TaskStart.do\?method=selectTaskMethod&mid=$1</to>
>
> Cheers
> Avlesh
>
> On Thu, Nov 5, 2009 at 1:58 PM, Roublard <alexey.petu...@...> wrote:
>
> > Guys, hi!
>
> > Have a problem here, kinda novice in url rewriting. Need a rewriting
> > rule from
> > /oc/TaskStart.do?method=selectTaskMethod&mid=91023909520346476
> > to
> > /methods/oc/91023909520346476
>
> > I've tried a lot of reqexps but still have no luck to create it. Could
> > you please provide me an example?
>
> > Looks like it could be simething like
>
> >    <rule>
> >        <name>redirect method selector</name>
> >        <from>^/oc/TaskStart.do?method=selectTaskMethod&mid=(.+)$</
> > from>
> >        <to type="permanent-redirect" last="true">/methods/oc/$1</to>
> >    </rule>
>
> > But it doesn't work of course :(
>
> > Thanks in advance!!!

--~--~---------~--~----~------------~-------~--~----~
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: get params to the url rewrite

by Avlesh Singh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

e.g. Here is my rule

<rule>
   <from>^/([A-Za-z0-9]+)$</from>
   <to>/test.do?id=$1</to>
</rule>

now when user provide the URL like : http://localhost:8080/test/prodcut001?code=001&name=test
then how can i pass "code=001&name=test" in the actual URL i.e. /
test.do?id=product001&code=
001&name=test

Changing your rule to the underneath should work as expected -
<rule>
    <from>^/test/(.*)\?(.*)$</from>
    <to>/test.do?id=$1&amp;$2</to>
</rule>

To make this work, don't forget to add "use-query-string=true" in the root node of your urlrewrite.xml file.

Cheers
Avlesh

On Mon, Nov 9, 2009 at 4:02 PM, baby <babybaby409@...> wrote:

Hi,

I am new to URL re-writing. I have the same question. How can i pass
the query parameters to the actual URL

e.g. Here is my rule

<rule>
   <from>^/([A-Za-z0-9]+)$</from>
   <to>/test.do?id=$1</to>
</rule>

now when user provide the URL like : http://localhost:8080/test/prodcut001?code=001&name=test
then how can i pass "code=001&name=test" in the actual URL i.e. /
test.do?id=product001&code=001&name=test

Thanks,
Baby

On Nov 6, 7:17 am, Avlesh Singh <avl...@...> wrote:
> > Have a problem here, kinda novice in url rewriting. Need a rewriting rule
> > from /oc/TaskStart.do?method=selectTaskMethod&mid=91023909520346476 to
> > /methods/oc/91023909520346476
>
> Are you sure that you want it written that way? Use cases are generally the
> reverse!
>
> Anways,
>
> if your answer is yes -
> <from>/oc/TaskStart.do\?method=selectTaskMethod&amp;mid=(.*)</from>
> <to type="permanent-redirect" last="true">/methods/oc/$1</to>
> Don't forget to turn on the "use-query-string" parameter in the root node.
>
> if reverse if what you wanted to do -
> <from>/methods/oc/(.*)</from>
> <to type="permanent-redirect"
> last="true">/oc/TaskStart.do\?method=selectTaskMethod&amp;mid=$1</to>
>
> Cheers
> Avlesh
>
> On Thu, Nov 5, 2009 at 1:58 PM, Roublard <alexey.petu...@...> wrote:
>
> > Guys, hi!
>
> > Have a problem here, kinda novice in url rewriting. Need a rewriting
> > rule from
> > /oc/TaskStart.do?method=selectTaskMethod&mid=91023909520346476
> > to
> > /methods/oc/91023909520346476
>
> > I've tried a lot of reqexps but still have no luck to create it. Could
> > you please provide me an example?
>
> > Looks like it could be simething like
>
> >    <rule>
> >        <name>redirect method selector</name>
> >        <from>^/oc/TaskStart.do?method=selectTaskMethod&mid=(.+)$</
> > from>
> >        <to type="permanent-redirect" last="true">/methods/oc/$1</to>
> >    </rule>
>
> > But it doesn't work of course :(
>
> > Thanks in advance!!!




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---