g1smd - 10:34 pm on Feb 21, 2013 (gmt 0)
Yes, you have the right idea for the code. Implementing this makes it almost impossible for there to be duplicate content issues on the site. The most resource-intensive bit is the database lookup. On sites where I have used this, all the old URLs had the ID number in too, so it was a very quick lookup.
Moving to the hyphenated extensionless URLs fixes a whole load of problems that you never knew could exist on a site.
RewriteRule ^([0-9]+)\-hockey\-.*$ php/sportsperson.php?sport=hky&id=$1 [NC,L]
There's a couple of problems with your rewrite. Try:
RewriteRule ^([0-9]+)-hockey-(.*) /php/sportsperson.php?sport=hky&id=$1&text=$2 [L]
The hyphens should not be escaped.
Don't allow aNyCase otherwise you'll have infinite Duplicate Content.
If $1 is not a valid ID make sure the script returns the correct 404 response.
Make sure that .* is captured and the value is checked it is the right text for this ID, otherwise you'll have infinite Duplicate Content.
If the $2 text is not right for this ID, make sure the PHP script redirects the user to the correct URL.
For an easy life, go all lower case for the URLs. Here's the simpler version of the normalisation code: [webmasterworld.com...]