after the first 100 or so I thought that there must be a rule to cover it
It depends on whether there's a pattern. For example:
old URL
www.example.com/stuff/otherstuff/morestuff.html
www.example.com/stuff/blahblah/morestuff.html
www.example.com/stuff/foobar/morestuff.html
new URL
www.example.com/morestuff/otherstuff.html
www.example.com/morestuff/blahblah.html
www.example.com/morestuff/foobar.html
That's a pattern that can be reduced to a Regular Expression:
RewriteRule stuff/([^/]+)/morestuff\.html http://www.example.com/morestuff/$1.html [R=301,L]
Or
old URL
www.example.com/blue-widgets.html
www.example.com/red-widgets.html
www.example.com/green-widgets.html
new URL
www.example.com/widgets/blue.html
www.example.com/widgets/red.html
www.example.com/widgets/green.html
The pattern then is:
RewriteRule (\w+)-widgets\.html http://www.example.com/widgets/$1.html
Going back to your original post:
www.example.com/articles/{nameofarticle}/{meaninglessnumbers}/
change to
www.example.com/{nameofarticle}/
If it's in the config file, keep the leading slash before "articles". If it's in htaccess, remove it:
RewriteRule articles/([^/]+)/\d+/ http://www.example.com ... and you can work out the last part for yourself ;)
If the numbers are always part of the old URL, it is best to include them in the pattern even though you won't be reusing them. It helps confirm that you're redirecting the right stuff.
Except, er, is every one of your articles in a directory by itself? That seems a bit chaotic. If there is anything after the numbers, you have to deal with it. mod_rewrite won't just reappend the rest of the path. At a minimum, simply capture it and stick it onto the target as $2.
Oh, yes. When I asked about location, I meant: Is the
actual filepath simply
home/domainname/nameofarticle.html
or is there rewriting going on in the background? If so you have to make sure you don't end up going around in circles.