I have made a custom error 404 page and have used .htaccess to use that using: ErrorDocument 404 "error_page.php"
Now the problem is that I have a profile.php page where I show users profiles. If a username mentioned in the URL doesn't exist then I redirect to index.php. Instead I want to show an error 404 page with my custom error page. Will this be enough to do that effectively?
header("HTTP/1.1 404 Not Found");
include 'error_page.php';
exit();
Thank you.