My sitemap that Google has been using for several years uses this format:
But now I’m moving to this format:
I guess there really is no way to use mod-rewrite to direct the old style to the new style, right? So is it going to be best to dynamically add the new format for the URL into the canonical link tag in my <header>?
[font=verdana]Yes, that’s pretty much it for “canonical” (except that I think you need to include the [noparse]http://[/noparse], but I know why you haven’t done that here )
There’s no way to use mod_rewrite to expand the URL from the short number-only to the long wordy one (although you could do it the other way round!), but you may find your CMS has a setting for whether you visibily or invisibly redirect users to the wordy URL – if it’s visibly (ie, if the URL shown in your address bar changes) then Google should pick up on this anyway, even without the canonical tag, but there’s no harm in putting both and going for belt-and-braces.[/font]
There IS a way to use mod_rewrite but it’s not available to webmasters (you must have access to the server - or vhost - configuration file): RewriteMap. I’ve also suggested (in my signature’s tutorial) how to use a “handler file” to do the same thing as a RewriteMap. IMHO, though, both are ridiculous excuses for not creating the link correctly in the first place. “Canonical” should do the trick (for SE’s).