Semicolon
Semicolon

Reputation: 1914

SilverStripe static error page

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.

Upvotes: 3

Views: 413

Answers (1)

3dgoo
3dgoo

Reputation: 15794

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.

Upvotes: 4

Related Questions