This was exactly what I needed. Thanks. I was in the vicinity, but the piece that I was missing was the initial (\d+). cheers Wayne On Thu, Feb 28, 2008 at 3:30 AM, Krist van Besien <krist.vanbesien@xxxxxxxxx> wrote: > On Thu, Feb 28, 2008 at 7:23 AM, wi <icebattle@xxxxxxxxx> wrote: > > > > Hi all > > > > I have a need to create a RewriteRule that will take something like > > > > /clubhouse/1234567/mediafile.jpg > > > > and turn it into > > > > /clubhouse/1/2/3/4/5/6/7/mediafile.jpg > > > > It seems like a relatively simple thing, but the number of digits in > > the source URI could be anything between 1 and 18, so the regex starts > > getting a bit hairy. > > > > Before I get too desperate, perhaps someone with potent regex chops > > would like to take a shot at it! > > You'll need to "loop". > > RewriteRule /clubhouse/(\d+)(\d)/(.*) /clubhouse/$1/$2/$3 [N] > > This rule will match as long as there are two consecutive digits, and > will split of one digit. The N flag causes rewriting to start again > with the new url. So this will be repeatedly evaluated until there are > no more consecutive digits.... > > So /clubhouse/1234567/mediafile.jpg > becomes /clubhouse/123456/7/mediafile.jpg > then /clubhouse/12345/6/7/mediafile.jpg > and so on > till you get /clubhouse/1/2/3/4/5/6/7/mediafile.jpg > > If you have more rewrite rules it is probably best to put this one at the start. > > > Krist > > > > -- > krist.vanbesien@xxxxxxxxx > krist@xxxxxxxxxxxxx > Bremgarten b. Bern, Switzerland > -- > A: It reverses the normal flow of conversation. > Q: What's wrong with top-posting? > A: Top-posting. > Q: What's the biggest scourge on plain text email discussions? > > > > --------------------------------------------------------------------- > The official User-To-User support forum of the Apache HTTP Server Project. > See <URL:http://httpd.apache.org/userslist.html> for more info. > To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx > " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx > > -- Cheers Wayne "I have not failed. I've just found 10,000 ways that won't work." Edison --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx