Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SilverStripe static error page

Tags:

silverstripe

Is it possible to set a static 404 error page without the need to create this page in the CMS SiteTree?

I tried setting an ErrorPage.ss in the Layout folder with the error text in there. It only works when the error page is created in the SiteTree.

like image 750
Semicolon Avatar asked Apr 15 '26 06:04

Semicolon


1 Answers

The 404 error page in the site tree outputs the page html to /assets/error-404.html for use in the case the site tree 404 page is not found.

In our main .htaccess should be the following line that sets where the server should look for the static 404 error page:

ErrorDocument 404 /assets/error-404.html

If we unpublish our 404 error page in the site tree the server will use this static html page. We can then edit the /assets/error-404.html file to control the static 404 error page.

like image 151
3dgoo Avatar answered Apr 18 '26 08:04

3dgoo