Setting custom error pages will allow you to notify your site visitors about any possible errors they might encounter with while browsing your site. Even at the best web sites visitors stumble upon an error page. Most common error page code is 404 also referred to as "page not found" error code. Editing default error page to a custom one is a great way to make these pages more helpful to your site visitors.

 

There are two different ways to edit your error pages. First is via cPanel and second is via good-old .htaccess file.

 

cPanel Method

1. Locate "Error pages" icon in the footer of your cPanel control panel and click on it

2. Select the domain you want to edit your custom error pages for

3. Select the type of error code you want to change your error page for

4. Enter a message to your visitors in HTML (you can also insert some common tags)

5. Click "Save"

 

.htaccess Method

1. Connect to your FTP server or use cPanel's file manager

2. Browse to the root folder of domain you want to edit your custom error pages for

3. Locate and edit .htaccess file (if you do not have an .htaccess file, simply make a new file called .htaccess)

4. Add the following lines:

ErrorDocument 404 http://mydomain.com/404.php

ErrorDocument 403 http://mydomain.com/403.php

If you do not want your site visitors seeing error pages, you can simply redirect them to your home page by adding the following line:

ErrorDocument 404 http://mydomain.com/index.php

These error codes are just shown as examples, here is the full list of error pages that can be defines:

 

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

Was this answer helpful? 2 Users Found This Useful (38 Votes)