Custom Error Pages

Author: Christian Sommer (doc)

Probably all of us have seen the Error 404 message - the result of broken links and mistyped URLs. Maybe you've already been on some websites where the error pages are customised with own logo and message, and I'm sure you'll agree that it looks far more professional than the standard one.

This guide shows you how to set-up customised error pages for your WebsiteBaker installation.

Prerequisite

To create customised error pages your webhoster features the Apache web server and allows to upload your own .htaccess file to your webspace.

Create a custom error404 page

  1. Go to the WebsiteBaker backend and create a WYSIWYG page called error404
  2. Provide some usefull text (e.g. please make sure the URL you typed in is correct, file was not found on the server, link to the start page or search form...)
  3. Set page visibility to hidden to prevent that the error page is shown in the menu.

Create the .htaccess file

Create the textfile htaccess.txt with the content shown below, upload it to the root directory of your WebsiteBaker installation and rename it into .htaccess (Note the . at the beginning of the file name).

<Files .htaccess>
order allow,deny
deny from all
</Files>
ErrorDocument 404 /pages/error404.php

The first part stops people viewing your .htaccess file. The second part tells Apache to redirect any 404 errors to the file "error404.php" assumed in pages directory located in the root directory of your domain (adjust the path to the directory where the WebsiteBaker config.php file is located).

Test it by calling a URL which does not exist on your domain like https://yourdomain.com/nirvana.html

Other error pages you may want to customise

400 Bad Request
401 Authorization Required
403 Forbidden
404 Not Found
500 Internal Server Error