Create a general rewrite rule in .htaccess In an upgrade scenario I have to provide some alias URLs like www.server.com/reading_23.html that should actually deliver www.server.com/reading/23.

I spent lots of hours trying to make that work by adding a line in .htaccess:

RewriteRule reading_(.*).html reading/$1


I have put that line into the standard D8 .htaccess, right after RewriteBase /. Unfortunately none of my attempts worked. The /reading is a path that's provided by one of my modules.routing.yml.

EDIT, 18.1.
This seems to be very special for Drupal because it just doesn't work with the existing D8 redirects. I can only make a redirection ([L,R]) work but I don't want my end-users to see the reading/23 path in their browser.
So actually the question is how to make URLs like reading_23.html possible with Drupal, the routing parameters can only live as separate parts of the path (like reading/{number} is ok but reading_{number}.html is bad).

Anyone who knows how to do this?

I do not want to create aliases in my Drupal DB for all node-Ids.

[EDIT Nr 2. 18.Jan 2017]

The Solution is an inbound Path Processor like 4k4 wrote. Thanks a lot.

[END EDIT]
I think your rewrite collides with the other rewrites in drupal standard .htaccess. Try a redirect. The redirect will be executed right away and the rest of .htaccess will no longer be processed. And it will also tell search engines that the url has changed.

RewriteRule reading_(.*).html reading/$1 [L,R=301]