The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

... to capture those url requests, but I'd like to be able to automatically map the value of xxxxx based on what $1 is.

So I am wondering if this map:key flag will do the trick. I can do it with multiple rules, each handling one parameter (and I will if it comes to that), but I would like to do it with one rule using the power of mod_rewrite and regexp if possible.

>> ${map:key [|def]}
>> Can anyone give me an example of it being used
>> and tell me a bit more about how it works/what it does?
Yes a real example could help to better understand the RewriteMap directive.

Example, really simple:

You want to redirect some users to a particular page.
You also want to store the relationship user--page into a separated file and you also don't want to edit the rewrite rules each time you add a new user.

That issue can be solved using the RewriteMap directive, so we could use:

doing that when we will have to add an user we need to edit only a text file ( or a php script can generate it ).
Remember that the file c:\usr\user2page.txt is cached internally so usually it's read only at startup or when the file is changed.
RewriteMap can be used only inside httpd.conf though .

Let me explain it better:
>> RewriteMap user2page txt:c:\usr\user2page.txt
here I'm saying:
create a map ( a ``function'' ) named user2page,
this ``function'' will search into a file called c:\usr\usr2page.txt

>> RewriteRule ^/user/(.+)$ ${user2page:$1|/nouser.php}
here I'm saying:
redirect all ``users'' to a page.
The name of the page is obtained by the ``user2page'' function passing to it as argument the user name.
If the user2page doesn't find a user with that key the value /nouser.php is used as default.

Speaking in php is something like:

function user2page( $username )
{
// search if inside c:\usr\user2page.txt
// there is a key called $username
// if so it returns the values of that key
// else it returns /nouser.php
}

So basically,

REQUEST_URI: /user/pippo
it will be redirected internally to
/path/to/pippo.php

REQUEST_URI: /user/pluto
it will be redirected internally to
/other/path/to/pluto.php

REQUEST_URI: /user/unknown
it will be redirected internally to
/nouser.php

Hope It was a bit more clear now,
eventually do not hesitate to ask :-)