How can I make a 404 error page in php?
Category: General Server Setup
I know there's option to customize 404 Not Found error page in cPanel, but it only allows editing .shtml file. But I'd like to process request_uri based on the data in my database. It looks like .shtml does not process php codes, then what option can I have?
Thanks for your question. I'm more than happy to assist you. Error handling is typically done through your .htaccess file. You should be able to add a line of code to your .htaccess file in the public_html folder to re-direct all 404 errors to a 404.php page. Here's the code to add to the .htaccess file to do so:
ErrorDocument 404 /404.php
Then is the same folder, you'll want to create the 404.php page and that should be it.
If you need further assistance please feel free to contact us.
Like this Question? Tweet