Currently in my PHP scripts, I redirect the user to a custom 404 not found error page when he/she tries to access content that doesn't exist or doesn't belong to that user. Like so:
header('Location: http://www.mydomain.com/error/notfound/');
exit;
I realize the above header() call sends a 302 redirect status code by default.
What I don't understand, however, is when I should send the 404 not found status code. Before I redirect the user? Or when I display the /error/notfound/ page?
Thanks for your help!