I need to rewrite (301) a few hundred url's and it would be good if this was possible with just one rule. I had a look at some instructions / explanations, as well as an old htaccess file which had something in it related to this and have come up with something (see below). I have to admit I don't understand half of what I have written, so am not at all sure that it is correct.
All the old url's are like this:
www.example.com/oldconstant-somekeyword-someotherkeyword-sometimesanotherkeyword-sometimes...-unique#.html
The new url's are supposed to be like this:
www.example.com/newconstant/unique#.html
I hope this makes sense. I basically want to change the first term (constant), keep the unique# (which has between one and three digits), and replace whatever is in between with '/'.
So far I got the following:
^/newconstant/([0-9]*).html$ http://www.example.com/oldconstant(.*?)-([0-9]*).html$ [R=301,L]
Any help would be much appreciated!