How to Set Up Custom Error Pages for Your Website

TrexHost – Best Web Hosting: Fast, Reliable & Affordable Solutions - Visit: https://trexhost.com

When a server error occurs on our servers, we display a default error page to your visitors. While these pages are functional, they include generic messages that don’t match your website’s design—which can be confusing and drive visitors away.

At TrexHost, we want you to deliver a seamless experience to your audience—even when errors happen. That’s why we give you full control to set up custom error pages that:

  • Match your website’s branding and layout
  • Provide helpful, user-friendly guidance
  • Reduce bounce rates by keeping visitors engaged
  • Maintain a professional appearance at all times

There are two methods that could be used to achieve this.

1) Editing the hosted domain/subdomain.

We have embedded the option to set a custom error page for server errors 400, 401, 403 and 404 inside the Hosted Domains section of your TrexHost Control Panel (My Domains > Hosted Domains).

Find your domain in the list and click on the “Edit Domain” icon from Actions column on the right. You are now able to edit the error page options.

You should see the following options:

Error 400 page:
Error 401 page:
Error 403 page:
Error 404 page:

Initially, all error pages are set to “Default“. To set a custom error page, choose “Custom URL” and enter the path to the corresponding error page in the field.

If you haven’t created one yet, do this first and then get back to the Hosted Domains section to update the settings.

2) Using .htaccess

Just like with the first method, which is described above, you must create the corresponding error page(s) first. When ready, open the File Manager section of your TrexHost Hosting Control Panel (Files > File Manager) and navigate to your domain/subdomain folder – it usually has the same name as your domain/subdomain and is located inside the www/ directory.

Inside the domain folder, create an empty file called .htaccess by clicking the New File icon in the File Manager (if no .htaccess file already exists in the folder). Then, edit the .htaccess file using the plain-text editor and insert the following code:

ErrorDocument 400 /custom400.html
ErrorDocument 401 /custom401.html
ErrorDocument 403 /custom403.html
ErrorDocument 404 /custom404.html

In the above example the custom 404 error page is located in the same folder as the .htaccess file and it is called custom404.html.

Edit the path and the name of each page accordingly to reflect the actual names and location of your custom error pages.

This method would work no matter what the settings in the Hosted Domains section are.

Leave a Comment

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

Scroll to Top