Htaccess Rule Giving Unexpected Result

I am moving from another CMS to Drupal 8. I have a bunch of URLs that will need to be forwarded. I have a number of these working in the htaccess file as expected, but one particular change is giving me unexpected results.

In my previous CMS, I had to use arbitrary file names in order to display items in any order other than alphabetical. So I might have articles/010_techtips and articles/020_events. In Drupal, I don’t need these, so I want to be able to capture incoming requests, search for the number and remove it.

In pseudocode, rewrite articles/010_techtips to articles/techtips.

I have written a rule with regexp that looks for the pattern and removes it. It checks perfectly in my regexp validation tool and the rewriterule works as expected when test at, but it does not work in Drupal.

Firstly, here is the rule in question:

RewriteRule ^(.*)([0-9][0-9][0-9]_)(.*)$ $1$3 [N=10,NC]

I’ve tried different flags, including DPI, NE, etc. If I omit the count on the N flag, I run out of memory, indicating an infinite loop. With the max loops set to 10 (or any value I’ve tried), i get:

[Tue Dec 20 12:17:11.922745 2016] [rewrite:error] [pid 91441:tid 2970218496] [client] AH02596: RewriteRule ‘^(.*)([0-9][0-9][0-9]_)(.*)$’ and URI ‘/articles/010_techtips’ exceeded maximum number of rounds (10) via the [N] flag.

It seems as though it processes the rule and then submits the same url sans changes to the loop again.

Any thoughts?

Drupal version: