Hey All - Did a search but couldn’t find quite what I need…I’m looking to restrict access (prevent it from displaying) to a site for staging/sandbox purposes, so nobody can see it except me and my developers. Is this possible with Kirby?
Check out the guide on authentication for a Kirby based solution. But in your case, wouldn’t it make more sense to restrict access via your server settings?
For sure…However this is a site that will be live and developers off my network. Thx for the guide and quick response
-Cheers
A very simple way to restrict access would be using a htpasswd
file. There are several tutorials and generators online.
This shouldn’t prevent you from using HTTP authentication (htpasswd
with Apache, probably other configs for other web servers).
One upside of simple HTTP authentication is that you can still use third party testing tools like http://www.webpagetest.org/ or http://yellowlab.tools/ since they accept HTTP user/password configs.
@lukasbestle & @fvsch - Thanks, will be reading
The there a simple way to password protect a Kirby website without .htpasswd ?
The server I’m on has no Apache installation. Only Nginx.
We like to hide the page until the launch, still be able to work on it remotely.
Thanks @texnixe, I was on there but then it is all about Apache and .htpasswd again.
Guess there is no other way then. Thanks.
If I understand this correctly, you only need the tools to create the files? No?
Other than that, you could check for a kirby user in the header, then files in media or assets are not protected, but maybe not that relevant because not easy to guess.
@texnixe maybe you are right. I’ll look into that.
Having the homepage only visible for users that are logged into the panel would be perfect. Is that possible?
You could add a simple route
'routes' => [
[
'pattern' => '(:all)',
'action' => function () {
if (!kirby()->user()) {
go('panel/login');
}
}
]
]
Or if you don’t want to redirect directly to the Panel, show them a message
'routes' => [
[
'pattern' => '(:all)',
'action' => function () {
if (!kirby()->user()) {
return new Response('Go to hell', 'text/html', 404);
}
}
]
]
You might want to be more polite than me after a long stressful day
@texnixe lol thanks a lot! Have a relaxed evening!