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:
http://www.mysite.com/cars/bwm
http://www.mysite.com/cars/crysler
The post is just:
http://www.mysite.com/cars/
The rest are just php query strings which were rewrited using add_rewrite_rule. So
http://www.mysite.com/cars/?bmw
is rewrited into:
http://www.mysite.com/cars/bmw
And sometimes the variable bmw is not inside my database, and I want this page to get a 404 response.
