Re: RewriteRule advice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/6/07, wi <icebattle@xxxxxxxxx> wrote:
> Hi all
>
> I need to create a rule to map requests such as
>
> /names/123/data
>
> to
>
> /names/1/2/3/data
>
> I can't control how many digits I need to split up like this, which is where
> my regex skillz are breaking down.

RewriteRule ^/names/([0-9]/)*([0-9])([0-9])(.*) /names/$1$2/$3$4 [N]

Because the N flag is used to make the rule loop, you'll need to be
VERY careful if you have any other RewriteRules, since they'll ALL be
reapplied. If you have other RewriteRules that you don't want to loop,
you could just repeat (copy-past) the above RewriteRule (without the
[N] flag) up to the maximum number of digits you'll need to replace.

Joshua.

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


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux