I can get kirby to route to the folder outside the content from within, i.e. /data, but then it does not check the user privileges. I used the instructions here to do so. However, that does not help me.
I have now moved the folder back into /content, i.e. /content/data and I am trying to use the custom response type to force kirby to load the html and pass it through. I believe this should work, but I can’t seem to read the index2.html file in order to pass it on. I always see the File can not be found! message.
Here is my route in the config.php file:
[ // protect the D.A.T.A.
'pattern' => '/data(:all)',
'action' => function($all) {
// if the user is not logged in, reroute to the login form.
if (!kirby()->user()) {
go('login?location=' . urlencode(kirby()->request()->path()));
}
// if logged in:
if (F::exists('/data'.$all)) {
//$html = file_get_contents('data/index2.html');
$html = F::load('data/'.$all);
return new Response($html, 'text/html');
} else {
return new Response('<html><body>File can not be found!</body></html>', 'text/html');
}
}
],