[ic] Re: mod_rewrite example? Does anyone have an was RE: [ic] Modifying link program and links to get rid of ?s and &'s in URL

S. Wong interchange-users@icdevgroup.org
Wed Jul 10 02:11:00 2002


Assuming that there is only a fixed number of parameters, this might 
work ...

For :
/cgi-bin/foundation/index/id=23942/mv_pc=1/st=db/co=yes
/cgi-bin/foundation/index?id=23942&mv_pc=1&st=db&co=yes

RewriteRule ^/cgi-bin/foundation/index/(.*)/(.*)/(.*)/(.*)$    
/cgi-bin/foundation/index?$1&$2&$3&$4    [PT,L]

This means that the rule awaits 4 parameters after index/ and will pass 
it back out as a query string in that order and it doesn't have to know 
what it was. ;-)

If there should me more, I guess a RewriteRule tree can be done in the 
config file or pass the parsing to a perl script that would traverse 
through the parameters after /index/... and split them up.

Lemme know if this work.  I haven't really tried it but from my 
experience writing rewrites, this should work. :-)

Dan Browning wrote:

> At 11:10 PM 7/6/2002 -0700, you wrote:
>
>> I'm not quite sure what you want done ... if you could give me an 
>> example of what you want goes to where, I might be of help.
>>
>> I've made mine such that a request for /foundation goes to 
>> /cgi-bin/foundation by using the ff:
>>
>> RewriteRule    ^/foundation/(.*)    /cgi-bin/foundation/$1    [R,L]
>>
>> You could also do Redirect /foundation/    /cgi-bin/foundation/
>> <- this does pretty much what the RewriteRule does, too.
>>
>> HTH.
>
>
> I would be happy for anyone to give a crack at it.  Here's what we 
> would like:
>
> Request from user:
>
> /cgi-bin/foundation/index/id=23942/mv_pc=1/st=db/co=yes
>
> Apache "Rewrites" the request as:
>
> /cgi-bin/foundation/index?id=23942&mv_pc=1&st=db&co=yes
>
> Additionally, something would have to be done to generate the urls 
> with "/" notation.
>
> Also, please note:
>
> <interchange-users guidelines>
> -- Contextual quoting is preferred, i.e.
>
>                 Quoting user1 (<user1@somedomain.redhat.com>):
>                 > Some limited text that will give context.
>                 >
>
>                 Your reply.
>
>     versus
>
>                 Your reply, lazily put at the top.
>
>                 Quoting user1 (<user1@somedomain.redhat.com>):
>                 > The whole big blob of the previous posts, including
>                 > signatures and all
>
>         In fact, the author of the program stops following a thread
>         the moment this lazy quoting method is used. He figures that
>         if you can't take half a minute of your time to save multiple
>         minutes of the readers time, the heck with ya.
> </interchange-users guidelines>
>
>
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | Dan Browning, Kavod Technologies <db@kavod.com>
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Of all the animals, the boy is the most unmanageable.
>                 -- Plato
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users


-- 
Ciao ?:-)
Shirlyn, the WebPrincess