Apache RewriteCond: inject string into URI between regex match groups

listed in answer

Apache RewriteCond: inject string into URI between regex match groups
0 votes, 0.00 avg. rating (0% score)

ANSWER:

If I understand what you’re doing right, which I may not, I’d say it can be simpler:

RewriteCond %REQUEST_URI !/d8(/|$)
RewriteRule ^/(foo|bar|baz)(/?.*)$ http://localhost:8081/$1/%TIME_YEAR1101$2 [P]

by Shane Madden from http://serverfault.com/questions/383179