Set up a Custom Error Page¶
You can design your own custom error pages and configure OpenLiteSpeed to display them for visitors who encounter errors (such as 404).
Custom error pages are configured at the virtual host level and may be set up in the WebAdmin Console, or by modifying the virtual host's configuration file.
WebAdmin Console¶
From the WebAdmin Console, navigate to Virtual Hosts and press the configuration icon.
Navigate to General > Customized Error Pages and press the + button.
Select the appropriate Error Code (in this example, we are choosing 404 Not Found
) and enter the URL to the custom error page (we put our custom file in the document root).
Restart OpenLiteSpeed to put the change into effect.
Configuration file¶
If the OLS WebAdmin Console is in read-only mode (such as with DirectAdmin), or you just prefer a command-line editor instead of the web GUI, you can locate the virtual host configuration file and edit it directly.
Add the following to the virtual host configuration. In this example, our customized 404.html
page is stored in the document root.
errorpage 404 {
url /404.html
}
Restart OpenLiteSpeed to put the change into effect.