Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Framework (only) and custom error pages


Reply

2 Posts   162 Views

Avatar
hello_world

26 June 2014 at 10:35am Community Member, 17 Posts

Hi,
I use only SilverStripe Framework (3.1.5) and I have problem with handling error page.
In CMS we have page type "ErrorPage". We set error code and content - OK.
But how build error page in framework controller?
1) When page not found SilverStripe returns 200 code.

[response:protected] => SS_HTTPResponse Object
(
[statusCode:protected] => 200
[statusDescription:protected] => OK
[headers:protected] => Array
(
[Content-Type] => text/html; charset=utf-8
)

[body:protected] =>
)

But in GoogleChrome inspector is 404

2) How set custom error page template? I use nginx and set error page - but when page is not found, only I can se is empty - white screen.

best regards

Avatar
Willr

28 June 2014 at 8:00pm Forum Moderator, 5511 Posts

My implementation of error pages with just a framework is at https://github.com/fullscreeninteractive/silverstripe-boilerplate/blob/master/app/code/controllers/AppController.php.