How to build a sitemap from the seo results of the filter, without pages where there is no product?

Hey all, had a task. In sitemap.xml add links to all possible filter options. In the end, the client now wants those links which have no products (these pages give 404 error) were not included in sitemap. How to check links? I think get_header , to get the status , if 404 then throw. But combinations of filter about 170 000 options, all of them difficult to verify, making the unloading of the steps is not high, a lot of time will occupy. How to make so that in sitemap, only pages where you have a product and did not get those where the 404 error.
June 5th 19 at 21:49
1 answer
June 5th 19 at 21:51
options:
1) go through the router
2) take log

Find more questions by tags Creating a site map