There was an old website located at http://domain.com. Then it has been replaced by a new website, with a totally new url configuration, leaving old domain, but switching to https-only. So now all http-requests are redirected to https://domain.com.The problem now is that there are a lot of search bot requests that try to access old-website urls and receive 301 as a response, redirecting to https site, and only then properly receiving 404.So, it's been several months now and it looks like bots are not going to forget about old urls. Maybe they just don't understand that kind of response and consider a page still alive? If that so, how could I possibly fix the problem? Naturally, I could allow users to interact with http-site as well (disable the redirect), but that's generally unsecure (though, probably, no big deal for a short time), so I'd rather not do this.
Is redirecting to 404 ok for SEO?
seo;301 redirect;404
Once you publish a URL, search engine bots such as Googlebot will request it for all time.   I still get requests for URLs retired 15 years ago.Redirecting to a 404 page isn't significantly worse than showing the 404 page directly.   Googlebot and other search engine bots will be able to understand that the page is missing when you redirect to a 404.You could consider showing a 410 Gone status page rather than a 404 page.   There isn't much difference between the two other than 410 will cause search engines to remove content from their indexes immediately as opposed to getting a grace period of a day for 404 status.The only thing that you can do that would be better would be to redirect the URL to replacement page.  If you have a replacement page, that would get all reputation and links that pointed to the old page to the new page.   I wouldn't redirect URLs to your home page (or other central page). Google considers such redirects soft 404.   It treats redirects to the home page the same as if the server returned 404 status.