Error page customization

Procédure

On an LWS Panel hosting account, the “Error Pages” tool lets you display your own page instead of the server’s standard error page for 401, 402, 403, and 404 errors. It stores nothing on your hosting account: it generates the ErrorDocument lines, which you then add yourself to the .htaccess file at the root of your site.

What types of error pages can I customize?

The “Error Pages” tool offers errors 401, 402, 403, and 404.

Explanation of error 401, Unauthorized
The request requires user identification. In practical terms, this means that all or part of the contacted server is protected by a password that must be provided to the server in order to access its content.

Explanation of error 402, Payment Required
This code is reserved by the HTTP standard and is very rarely used by websites.

Explanation of error 403, Forbidden
The HTTP server understood the request, but refuses to process it. (The error appears when no index.html, htm, or PHP page has been found at the root of the FTP account)
This code is generally used when a server does not wish to indicate why the request was rejected, or when no other response matches (for example, the server is an intranet and only machines on the local network are allowed to connect to the server).

Explanation of error 404, Not Found
The server found nothing matching the requested address (URL).
This means that the URL you typed or clicked is wrong or outdated and does not correspond to any existing document on the server (you can try gradually removing the components of the URL starting from the end to possibly find an existing path).

How can I customize my error pages?

  1. Create your error page

    First create the page to display (for example a 404.html file, or a .htm or .php page), then upload it to your site using the file manager or via FTP.

  2. Open the “Error Pages” tool

    Log in to your hosting account, then in the “Databases & PHP” section of the dashboard, click Error Pages.

    Error page customization

  3. Specify the location of your pages and generate the code

    On the “Customize your 404, 403, 402 and 401 error pages” page, fill in the fields for errors 401, 402, 403, and 404 with the location of your pages, then click Generate. The code appears in the “Your generated .htaccess file” area.

    The fields are prefilled with examples (https://my-example-site.com/…): a generated line that still contains “my-example-site.com” must be deleted.

    Error page customization

  4. Copy the code into your .htaccess file

    Copy the generated lines (one ErrorDocument line per error), then add them to the end of the .htaccess file at the root of your site, for example using the file manager. If this file does not yet exist, create it as indicated in the green box on the page: paste the code into a file, upload it to the root of your site, then rename it to .htaccess.

Check that your page displays

Open in your browser an address on your site that does not exist (for example your domain followed by /nonexistent-page): your custom 404 page should display instead of the standard error page.

To return to the standard error page, delete the corresponding ErrorDocument line from your .htaccess file.

Note: this procedure currently does not work with not found files having the .php extension

How do I customize error pages?

What is the benefit of customizing error pages?

When designing a website, it can happen that your visitors land on a page on your site that no longer exists. For example, when you create the site www.example.com. On this site, there are of course several pages... And, as your site becomes better known, other websites place your links on their pages. However, if you modify this page, the visitor will then land on an error page.

Related articles

Conclusion

You are now able to create custom error pages on your shared hosting with LWS.

Feel free to share your feedback and questions!

help.lws.net/a/97
Was this article helpful?

Yes

No

Read 28 111 times

Thank you! Feel free to ask questions about our documentation if you would like more information, and help us improve it.

Similar articles

A question about this article?

Ask the LWS team and the community. Answers are published after moderation.

Ask the LWS team and its community a question

GDPR: Controller: LWS-Ligne Web Services. Purpose: moderation and public publication of your question, possible notification of an answer. Legal basis: consent (Art. 6(1)(a) GDPR). Email retention: 90 days after notification, 12 months maximum without an answer. To exercise your rights, see the GDPR section of our Terms and Conditions.