Actually, I lied a bit. We're not using mod_rewrite for
these, but a little C++ ISAPI filter for IIS using
boost.org's Regex++.

However, you can do query strings from mod_rewrite as well.
Using RewriteCond for something like your example:

RewriteCond %{QUERY_STRING} id=([^&;]*)
RewriteRule (.*)articles\.psp $1articles/%1? [L]

Or something close to that. Relevant parts: RewriteCond
backreferences use %1,%2 etc as opposed to regular
backreferences $1,$2. The trailing question mark on the
RewriteRule tells it to remove the query string from the
request (i suppose this would be optional..?)

Now, for my purposes (where the incoming URL is already
correct sans-querystring, and I actually want to reinsert a
querystring for the servlets) it's very easy. If you
include a ? in the substitution string, mod_rewrite's docs
say it will automatically modify QUERY_STRING. 

RewriteRule (.*)articles/([0-9]+) $1articles?id=$2 [L]

Again, not tested but it's close.

Luke

--- Mike Orr <[EMAIL PROTECTED]> wrote:
> On Fri, Apr 26, 2002 at 02:46:00PM -0700, Luke Opperman
> wrote:
> >   http://www.somewhere.com/products.psp?id=502
> 
> Are you able to use mod_rewrite with query strings?  I've
> got a
> (non-Webware) application that stupidly funnels articles 
> through 
>       /article.php?article_id=1234
> and I would like to redirect each article to a new URL
>       /article/1234
> or (in other cases) redirect a few articles while letting
> all
> the others pass thorugh.
> 
> But whenever I try to use mod_rewrite, it strips the
> query string
> off the source URI, so I can't match according to query
> string.


=====
------------------
Reference Counting Garbage Collection:
Look out philosophy majors, things really DO
cease to exist when no one is looking at them!
------------------

__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to