Hello,
I have created a custom 404.html page and redirect users when they open any routes that are not available.
I want to redirect user to this 404 page after I receive data from backend. e.g I have an API called getPostData() and it returns a variable called is_post_expired.
if(response.data.is_post_expired===true){
window.location.href = "/not-found";
}
and in _redirects file i have added
/not-found /404.html 404!
Is there any way i can return 404 without changing the url?. The URLs uses posting id which is dynamic .