How to fix the Rewrite?

A week can't overcome the problem, really all exhausted.
Describe my problem...

I moved my DLE Drupal, moved all the info and stuff.
Of the more than 5,000 pages, the page address has changed but is very simple for example...

on DLE was so
/razdel/584_ya_vottakaya_stranica.html
Where 584 is the ID of the news DLE.

That is, in Drupal this is not in Drupal, the url looks like this
/razdel/ya_vottakaya_stranica.html

And everything would be cool, writing ordinary Rewrite of this pravidla
RewriteRule ^(section\/)([0-9]+-)([-a-z0-9]*).html$ /$1$3.html [R=301,L]


Which makes a redirection
C /razdel/584_ya_vottakaya_stranica.html
TO /razdel/ya_vottakaya_stranica.html

And it works great BUT there is a problem!
There is such news, for example
12 years gave him
Ie url in DLE it
ID+the name of the news
543_12_let_dali_emy.html
And here comes the problem!
The Rewrite rule that checks the url and sees
543_12_let_dali_emy.html
Cuts off 543_ and 301 redirects
And then to see the url
12_let_dali_emy.html
And again cuts 12_
But 12 in our case, the name of the news!

The problem is that he reads the rule twice.
I tried to get him to read rule 1 again, still without success
Even tried to make nginx rule...

Please help good people!!!!
How to fix this error?

Can someone tell the secret of how to make that rule for this URL 1 time.
For example, maybe someone will do it in php.
September 19th 19 at 12:23
2 answers
September 19th 19 at 12:25
Try the regular season
^section\/\d+_(\d+_)?([\d\w_]*)\.html$ /section/$1$2.html


I recommend reading Jeffrey Friedl Regular expressions
September 19th 19 at 12:27
Install the pathauto module, it allows you to create templates for the URL.
in this case, the template will look like this:
razdel/[node:nid]_[node:title].html

you can create templates for all types of nodes or for each type separately.

so you don't need me to rewrite.

If you have headings in Russian, don't forget to put the Transliteration module for transliteration of synonyms.

Find more questions by tags Processing URLDrupal