How can I make a 404 error page in php?


Wonjae
Asked:
2012-02-20 1:54 am EST

Hits: 3,843
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.

OTHER ANSWERS

0

Tim S.
Staff
9,967 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:

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.

Thanks!

Tim S

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

Like this Question?

News / Announcements

WordPress wp-login.php brute force attack
Updated 2014-07-17 06:43 pm EST
Hits: 200936

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

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: support@InMotionHosting.com
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!