Knowledgebase: Site Functions
Use Custom Error Pages
Posted by on 28 October 2013 01:16 PM

We’ve all seen the dreaded 404 error messages that are unfortunately a fact of the internet. If someone is browsing your website and clicks an invalid link they will likely be directed to a vague and boring 404 page… and that’s not ideal.

With just a little bit of work it’s very easy to create a custom 404 error page just like ours at http://www.cirtexhosting.com/error.

You will need two things to get started:

  • Custom 404 error page that you have designed

  • Little bit of code added to an .htaccess file that tells the server that you have a custom 404 page in place

You’ll need an .htaccess file to begin implementing your new 404 message.

If you already HAVE an .htaccess file in the public_html folder of your cPanel account, then simply add the text below to the top of the file and save it:

ErrorDocument 404 /404.html
 

Note: this is assuming that you have named your 404 error page ‘404.html’ and placed it inside the public_html folder. If you have not named it that way, make sure the code shown above reflects the proper name of your 404 file.

If you DO NOT already have an .htaccess file in the public_html folder then you’ll just need to create one:

  1. Open your favorite text editor (notepad, textedit)

  2. Save the file as .htaccess (yes, that ‘.’ at the beginning is supposed to be there)

Once the file has been created add the code shown below to the file and save it again:

ErrorDocument 404 /404.html
 

Note: this is assuming that you have named your 404 error page 404.html and placed it inside the public_html folder. If you have not named it that way, make sure the code shown above reflects the proper name of your 404 file.

Now, all that’s left to do is upload this file via either FTP or cPanel File Manager, and make sure that it’s in the public_html folder of your cPanel account.

You’re not restricted to only having a custom 404 error page… there are several error codes that you can create custom pages for, including:

Client Request Errors
400 - Bad Request
401 - Authorization Required
403 - Forbidden
404 - Not Found
405 - Method Not Allowed
406 - Not Acceptable (encoding)
407 - Proxy Authentication Required
408 - Request Timed Out
409 - Conflicting Request
410 - Gone
411 - Content Length Required
412 - Precondition Failed
413 - Request Entity Too Long
414 - Request URI Too Long
415 - Unsupported Media Type

Server Errors
500 - Internal Server Error
501 - Not Implemented
502 - Bad Gateway
503 - Service Unavailable
504 - Gateway Timeout
505 - HTTP Version Not Supported

Tip! Check out our video tutorial on how to create a custom error page: http://www.cirtexhosting.com/tutorials/x3/cpanel-x3-error.html.

If you need any assistance with this, please do not hesitate to get in touch with our Support team! We’re here to help.

(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
Help Desk Software by Kayako fusion