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:
incorrect: wrestleview.com/20060-update-on-joey-mercury-and-his-wwe-status
Correct: wrestleview.com/wwe-news/20060-update-on-joey-mercury-and-his-wwe-status
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.
Thanks
.htaccess
in the form of aRewriteRule
. Basically you want to work out how to say, "if the URL starts with the domain, followed by a slash and X digits, rewrite the URL to the Ugly Permalink" (example.com/?p=X
) which will then re-redirect to the full URL.