Out of stock items getting 404's in search results

The issue happens (404) when a link to that product still exists on the web e.g. pinterest and it can’t find the item on your website.

You need to create 301 redirects for every item you delete / archive or make inactive.

Sales Channels → Online Store → Navigation → View URL redirects (top right bottom on page)

You redirect from the inactive item to either a replacement item or to a collection.

\product\abc

to

\product\xyz or \collection\efg

Hope this helps. Sue