Conditional 404 response based on inclusion of /node/# in URL I've been requested by a client to completely block the URLs that contain a /node/## after the hostname to prevent these locations from being indexed by search engines.  My issue is that I've already defined a Page Not Found node that gets shown with error 404s.  

I've already implemented a modification in the robots.txt file to include

Disallow: /node/
Disallow: /?q=node/


to prevent the web-crawler bots.  However, the URLs are still directly accessible.  So in this case, the client wants two different 404 actions:


www.clientname.com/testttt -> Drupal renders 404 page
www.clientname.com/node/897 -> blocked completely without returning Drupal's 404 page.


Does any module allow for this kind of functionality?
What about using hook_init in a custom module?

function hook_init() {
    // check arg(2) is empty as otherwise will block node edit and delete pages
    if(substr($_SERVER['REQUEST_URI'], 0, 5) == '/node' &amp;&amp; arg(2)=='') {
        die(); // to stop completely
        //return drupal_not_found(); // to return 404 page
        //return drupal_access_denied()(); // to return 403 page
    }
}


Saying that it would be quicker to block these pages in .htaccess...