Need help regarding custom functionality

hello there i am create blog listing and blog detail page. i have added serverPrefetch function in component to set meta details and fetched data for dom in created method now i want to redirect to my 404 page if no blog found on db but i am unable to redirect can anyone help me with this?
thanks in advance.