How can I lead to 404 Page Not Found when View page has no result? How can I lead to 404 Page Not Found when View page has no result?

I tried this code from http://drupal.org/node/1295824#comment-5192868in "empty text" but the View page still exist with only page title eve if it has not result to list.

&lt;?php
drupal_set_header('HTTP/1.1 404 Not Found');
?&gt;
You should use the drupal_not_found() function. It sets the correct headers, omits blocks from the page output to conserve CPU and bandwidth, and is the correct way to set a 404 through code in Drupal.

Also see drupal_access_denied() which might be useful.