I have the previous logic to feed a View in MY_TEMPLATE_preprocess_page
.
When the URL, where I have some paremeters passed in a user friendly way, does not exist (the parameters are not correct), I am serving a "Product not found message". However, I think it is more correct, for SEO purposes, to serve a 404-Not Found page, with the correct HTTP Headers. I am trying to achive this with drupal_not_found
but the page takes a minute to load and finally shows a blank screen.
Where should I put the logic and the drupal_not_found
call? Must I move it to my custom module, in MY_MODULE_init() or something? I need to access $node->nid
.
Example:
Correct : http://www.example.com/products/shoes
Wrong (404) : http://www.example.com/products/dsfsdfswerweipwr