I have a situation where I want to redirect the user from single.php to my 404.php
How can I do this?
I did it like this inside single.php
header("HTTP/1.0 404 Not Found"); header("Location: ".bloginfo('template_url')."/404.php"); exit();
But when I check the http responses I get a 302 response instead of the 404
Important: it may not work because I have a post called "cars" which I use to custom generate pages like:
The post is just:
The rest are just php query strings which were rewrited using add_rewrite_rule. So
is rewrited into:
And sometimes the variable bmw is not inside my database, and I want this page to get a 404 response.