Apache RewriteCond: inject string into URI between regex match groups
listed in answer
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

New Comments