I have recently gone through a couple of site transfers and permalinks have been changed along with my domain. I have a lot of links both on social media and reddit that have old links. They are being directed to a 404 page. Is there any way to smartly direct these pages to a search page that uses keywords from the url?
Here is my current HTACCESS:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Here is an example of a link that doesn't work:
https://lifeandhealth.co/2016/06/12/book-club-sapiens-by-yuval-harari/
Here is the new link:
https://prestopost.org/book-club-sapiens-by-yuval-harari/
All the articles are on the site, and can be found with a one or two keywords from the end of the url.
Is there a plugin, or preferably some code to add in that will do this?
Thanks
In my point of view so here you go.
RewriteRule ^(.+)$ /?s=$1 [NC,L,R=404]
Edit:
Or you maybe use this plugin Smarty 404.