Creating custom error pages
Visitors to your site will be expecting to see the correct content. But, sometimes things go wrong, for example, they may have clicked an old link - and the content they are expecting to see isn't available. In situations like this they will be presented with an Error page, displaying one of many HTML error codes.
The most common are:
404 - Page not found - that page/content is no longer available
403 - Forbidden - the visitor does not have permission to access this content
500 - Internal server error - something went wrong on the server that prevented it from serving the content
Most servers have standard error pages - but it is possible to create your own, custom pages, styled to your site - to give a better user experience.
Creating custom error pages is actually a quick and easy task and can be achieved with very few steps, some premium Content Management System (CMS) themes even include support for custom 404, 403, 500 and other error pages within the theme. Alternatively you can also design your own custom pages within your CMS
or in HTML/CSS.
If your theme has options to choose custom error pages you should just be able to select them there - no further action is required.
If not, once you've created your custom error pages you can reference them in your .htaccess file in the following format;
In the example above, a 404 'Page Not Found' error rather than showing the generic server 404 page will show your custom designed 404 page in its place.
You can name your custom error pages whatever you like - just replace the filenames (e.g. 403.html) in the example above with your page name.
Other error codes/pages can be created however we find that the above three will cover 99% of use cases for most customers. If you wanted to add additional pages, you would simply add them in the same format provided above.
*
*
The most common are:
404 - Page not found - that page/content is no longer available
403 - Forbidden - the visitor does not have permission to access this content
500 - Internal server error - something went wrong on the server that prevented it from serving the content
Most servers have standard error pages - but it is possible to create your own, custom pages, styled to your site - to give a better user experience.
Creating custom error pages is actually a quick and easy task and can be achieved with very few steps, some premium Content Management System (CMS) themes even include support for custom 404, 403, 500 and other error pages within the theme. Alternatively you can also design your own custom pages within your CMS
or in HTML/CSS.
If your theme has options to choose custom error pages you should just be able to select them there - no further action is required.
If not, once you've created your custom error pages you can reference them in your .htaccess file in the following format;
ErrorDocument 403 403.htmlErrorDocument 404 404.htmlErrorDocument 500 500.html
In the example above, a 404 'Page Not Found' error rather than showing the generic server 404 page will show your custom designed 404 page in its place.
You can name your custom error pages whatever you like - just replace the filenames (e.g. 403.html) in the example above with your page name.
Other error codes/pages can be created however we find that the above three will cover 99% of use cases for most customers. If you wanted to add additional pages, you would simply add them in the same format provided above.
*
*
Updated on: 24/01/2024
Thank you!