Simple error pages personnalisation

Hello,

I would like to customise HTML error pages so there is no Bunkerweb information displayed (basically, I would only display a blank page with the error number).

I tried to create simple html files (very simple, just ‘HTML’ and ‘BODY’ tags) with only the error number in it, put them in /usr/share/bunkerweb/core/errors/files/ and in my Bunkerweb service config, in the “Errors” plugins, I added a line for each error/pages like :

401=401.html
404=404.html

The permissions are the same as the already existant /usr/share/bunkerweb/core/errors/files/error.html file.

When I try to simulate an error, these errors pages are not load and I just get a “Too many redirect” browser error.

What have I done wrong ?

Thank you !

Hi,

I think the problem is just where you put your files. Custom error pages don’t get served from /usr/share/bunkerweb/core/errors/files/, since that’s BunkerWeb’s internal core directory. They need to go in the folder defined by your ROOT_FOLDER setting, which by default is /var/www/html/{server_name}.

That’s also why you’re getting the “too many redirects” error. BunkerWeb can’t find the page where it expects it, so it keeps looping while trying to load the error page.

Here’s how to fix it:

  1. Move your HTML files into your site’s root folder, for example /var/www/html/<your_server_name>/401.html and /var/www/html/<your_server_name>/404.html.

  2. In the Errors plugin, write the ERRORS setting using paths relative to that root folder, with a leading slash:

    ERRORS: "401=/401.html 404=/404.html"
    
    

    So 401=/401.html instead of the bare 401=401.html you used.

  3. Double check the files are readable by BunkerWeb, and that the codes you want are present in INTERCEPTED_ERROR_CODES.

After that, your minimal pages with just the error number should load fine, with no BunkerWeb branding.

One more thing: if you happen to be on the PRO version, there’s also the Custom Pages plugin (CUSTOM_ERROR_PAGE), which takes a full absolute path instead of a path relative to the root folder.

Hope that sorts it out!