Currently my 404 page looks like this: example.com/404.php . Is it possible that I could rewrite it to example.com/filethatdoesnotexist.php in .htaccess. I think you could do in php but I would rather use .htaccess. If you can't, how do you do it in php?
it's perfectly achievable, in .htaccess simply put:
ErrorDocument 404 /filethatdoesnotexist.php
that will work to run that php page whenever the server sends a 404 error response