I have many articles linked from external sites without categories. They end up with a 404 not found. A minor migration was done a long time ago and just noticed the 404s.
One of many examples:
I want when people click on a link with no category to automatically redirect to the ID and post name. Since there is always a unique ID to each post. Can this be done through htaccess or functions.php? I cannot do a 301 redirect manually, I have over 1000 links affected by this.