I'm migrating a huge site from an old proprietary CMS to WordPress and need to redirect the old URL structure.
The old system has all kinds of whacky URLs, but the one thing common to them all is that they contain a number which identifies the post, like this:
example.com/something/else/123456/another/thing.html
example.com/something/98765/thing.html
example.com/something/2468/.html
(The third one is not a typo!)
What htaccess rewrite rule will redirect any of these to a URL of the form example.com?oid=1234
, where oid
is the number extracted from the old URL?
So far I've come up with this, which is not working:
RewriteRule ^/.*([0-9]+)/.*\.html /?oid=$1