InMotion Hosting Support Center

How can I make a 404 error page in php?

2012-02-20 1:54 am EST

Hits: 4,577
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?

You must login before you can ask a follow up question.

You must login before you can submit an answer.



Tim S
13,821 Points
2012-02-20 9:39 am EST
Hi Wonjae,

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:

<p class="code_block">ErrorDocument 404 /404.php</p>

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.


Tim S

You must login before you can post a comment about this answer.

Like this Question?

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!