This is the second part of the first Series which was installing Apache, MySQL, PHP and WordPress. In this series, we are going to talk about how to create your own custom HTTP error codes.

HTTP error codes are codes that are activated as a result of something that has gone wrong or couldn’t be resolved or couldn’t be found or when their s something that has gone wrong with the server.

Here are some of the causes of HTTP error codes

  • When a person searches for a file or document that isn’t available
  • When you’re trying to access an authorized content
  • When there is a server error etc  

Below is a list of some HTTP codes and what they mean;

After finishing setting up my WordPress site, I had to set up y own custom error code so that whenever an error 404, 403 etc appears it comes with my custom error page as shown below:

The above image appears on a 404-error message.

The above image appears on a 403-error message.

To customize your own HTTP error message, you need to follow the following steps

  1. The first thing is to log in to your server and to go to the root directory /var/www/html/ and upload the images that you want to use.
  2. Create Html files which are going to contain the following line of codes for each desired error code
  1. Next step is to go to /etc/apache2/sites-available/ and add the following pieces of codes respectively

After doing all the configuration all you have to do is to save the configurations you made respectively and then you finalize by restarting the Apache server by typing the following codes

Once you have restarted your server just go to your browser and type in your websiteurl/403.html to test and see if the custom-made error codes are working.

Download Custom HTTP Error Code

Leave a Reply

Your email address will not be published. Required fields are marked *