# Secure directory structure

**URL:** <https://forum.getkirby.com/t/secure-directory-structure/12382>\
**Category:** Questions\
**Tags:** v3\
**Created:** [January 23, 2019, 9:25am UTC](https://forum.getkirby.com/t/secure-directory-structure/12382 "2019-01-23T09:25:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![daybugging](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@daybugging](https://forum.getkirby.com/u/daybugging)\
**Post date:** [January 23, 2019, 9:25am UTC](https://forum.getkirby.com/t/secure-directory-structure/12382/1 "2019-01-23T09:25:04Z")

</div>

Hey there,  
just a quick question, and I guess you can help me out easily:

What parts of a Kirby installation need to be in the “public” (root) directory of the webserver? [Kirby docs](https://getkirby.com/docs/guide/configuration#custom-folder-setup) mention that you should put some stuff below root, and also Composer’s vendor shouldn’t be publicly available, so what’s the most hardened setup for Kirby v3?

Thank you all for making the new version such a great tool!  
daybuggin’

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [January 23, 2019, 9:34am UTC](https://forum.getkirby.com/t/secure-directory-structure/12382/2 "2019-01-23T09:34:45Z")

</div>

Check out the [getkirby.com website repo](https://github.com/getkirby/getkirby.com) itself. The `/www` folder is the web root that contains the public facing files, basically only the assets, the `index.php` (and the media folder, that doesn’t exist in the repo). The public folder setup is defined in the `index.php`

---

<div class="post-metadata">

**Author:** ![daybugging](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@daybugging](https://forum.getkirby.com/u/daybugging)\
**Post date:** [January 23, 2019, 9:36am UTC](https://forum.getkirby.com/t/secure-directory-structure/12382/3 "2019-01-23T09:36:54Z")

</div>

Thanks, that’s helpful!

As always 😘

---

<div class="post-metadata">

**Author:** ![luca](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/luca/32/5591_2.png) [@luca](https://forum.getkirby.com/u/luca)\
**Post date:** [March 10, 2020, 10:48pm UTC](https://forum.getkirby.com/t/secure-directory-structure/12382/4 "2020-03-10T22:48:21Z")

</div>

What’s the differenc between the setup for [getkirby.com](http://getkirby.com) in the /www folder and the explananation of a public folder setup in [Kirby’s Guide](https://getkirby.com/docs/guide/configuration#custom-folder-setup__public-folder-setup)?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 10, 2020, 10:52pm UTC](https://forum.getkirby.com/t/secure-directory-structure/12382/5 "2020-03-10T22:52:36Z")

</div>

This is the index.php from the `getkirby.com` website:

```auto
<?php

include '../kirby/bootstrap.php';

$kirby = new Kirby([
    'roots' => [
        'index' => __DIR__ ,
        'content' => __DIR__. '/../content',
        'site' => __DIR__. '/../site',
    ],
]);

echo $kirby->render();

```

If you compare that to the version in the guide, you will notice that the guide example has an additional `storage` folder, where the `/accounts`, `/session` and `cache` folders are located.

Both are just examples, nothing you have to follow.

---

<div class="post-metadata">

**Author:** ![luca](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/luca/32/5591_2.png) [@luca](https://forum.getkirby.com/u/luca)\
**Post date:** [March 10, 2020, 10:56pm UTC](https://forum.getkirby.com/t/secure-directory-structure/12382/6 "2020-03-10T22:56:06Z")

</div>

Thanks for the lightning fast reply. I’m still new to this and want the setup to be as secure, as possible. So I can just use any of both examples…

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 10, 2020, 10:58pm UTC](https://forum.getkirby.com/t/secure-directory-structure/12382/7 "2020-03-10T22:58:49Z")

</div>

Note that such a setup only makes sense if you are not on shared hosting, because on shared hosting, you cannot usually put anything above the document root.

---

<div class="post-metadata">

**Author:** ![bnomei](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bnomei/32/775_2.png) [@bnomei](https://forum.getkirby.com/u/bnomei)\
**Post date:** [March 11, 2020, 8:27am UTC](https://forum.getkirby.com/t/secure-directory-structure/12382/8 "2020-03-11T08:27:02Z")

</div>

you can find a more advanced public folder setup [here](https://github.com/bnomei/kirby3-with-public-folder-kit). this one puts all data that might change in the storage folder (good for automized zero-downtime deployments). since that requires a symlink for kirbys media folder i would not recommend it for beginners but it provides another example how versatile [kirbys roots](https://github.com/getkirby/kirby/blob/master/config/roots.php) can be configured.

---

<div class="post-metadata">

**Author:** ![luca](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/luca/32/5591_2.png) [@luca](https://forum.getkirby.com/u/luca)\
**Post date:** [March 12, 2020, 10:31pm UTC](https://forum.getkirby.com/t/secure-directory-structure/12382/9 "2020-03-12T22:31:04Z")

</div>

Thank you, I will check that out, when I am ready to deploy my site. This is such a cool community! 🥰
