# Return multiple php files on 404 error

**URL:** <https://discourse.slimframework.com/t/return-multiple-php-files-on-404-error/3024>\
**Category:** Questions\
**Created:** [March 10, 2019, 3:26pm UTC](https://discourse.slimframework.com/t/return-multiple-php-files-on-404-error/3024 "2019-03-10T15:26:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mas886](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/mas886/32/845_2.png) [@mas886](https://discourse.slimframework.com/u/mas886)\
**Post date:** [March 10, 2019, 3:26pm UTC](https://discourse.slimframework.com/t/return-multiple-php-files-on-404-error/3024/1 "2019-03-10T15:26:29Z")

</div>

Hey there, I’m using Slim as the URL controller for my webpage, then I use simple PHP+HTML files to build my webpage GUI, this is giving me no problem and it’s been working perfectly, but I want to use a custom 404 php file as the Slim 404 default page, the only way I found on how to do that is the following:

// Create container  
$container = new \Slim\Container;

// Register component on container  
$container[‘view’] = function ($c) {  
$view = new \Slim\Views\Twig(‘view/pages/’);  
$view-\>addExtension(new \Slim\Views\TwigExtension(  
$c[‘router’],  
$c[‘request’]-\>getUri()  
));  
return $view;  
};

//Override the default Not Found Handler  
$container[‘notFoundHandler’] = function ($c) {  
return function ($request, $response) use ($c) {  
$c[‘view’]-\>render($response, ‘header.php’);  
$c[‘view’]-\>render($response, ‘404.php’);  
$c[‘view’]-\>render($response, ‘footer.php’);  
return $response-\>withStatus(404);  
};  
};

$app = new \Slim\App($container);

The obvious problem here is that it expects a Twig file to build the interface, so it won’t parse the php code on my files, how can I return my php files normally on 404 so this page is rendered as the rest of the webpage?
