# Valid url without folder in the panel

**URL:** <https://forum.getkirby.com/t/valid-url-without-folder-in-the-panel/2342>\
**Category:** Questions\
**Tags:** v2\
**Created:** [October 28, 2015, 4:21pm UTC](https://forum.getkirby.com/t/valid-url-without-folder-in-the-panel/2342 "2015-10-28T16:21:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![emilien](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/emilien/32/1135_2.png) [@emilien](https://forum.getkirby.com/u/emilien)\
**Post date:** [October 28, 2015, 4:21pm UTC](https://forum.getkirby.com/t/valid-url-without-folder-in-the-panel/2342/1 "2015-10-28T16:21:09Z")

</div>

hi all,

i was searching with no success if it’s possible to have a valid url without creating the corresponding folder in the content folder.  
For example:

```
c::set('routes', array(
  array(
    'pattern' => 'sitemap',
    'action' => function() {
      return page('sitemap');
    }
  )
));

```

with a sitemap.php in the template folder,  
so users don’t see an invisible useless “sitemap” page in the panel.

---

<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:** [October 28, 2015, 4:25pm UTC](https://forum.getkirby.com/t/valid-url-without-folder-in-the-panel/2342/2 "2015-10-28T16:25:24Z")

</div>

Yes, you can do that:

```php
c::set('routes', array(
    array(
        'pattern' => 'sitemap',
        'action' => function() {
          tpl::load(kirby()->roots()->templates() . DS . 'sitemap.php', array('uri' => $uri), false );
        }
    )
));

```

---

<div class="post-metadata">

**Author:** ![emilien](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/emilien/32/1135_2.png) [@emilien](https://forum.getkirby.com/u/emilien)\
**Post date:** [October 28, 2015, 4:32pm UTC](https://forum.getkirby.com/t/valid-url-without-folder-in-the-panel/2342/3 "2015-10-28T16:32:04Z")

</div>

wow that was quick!  
thanks.

working but i have an error on the page.  
Can i access snippets and $site varibles when loading templates this way?

---

<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:** [October 28, 2015, 5:05pm UTC](https://forum.getkirby.com/t/valid-url-without-folder-in-the-panel/2342/4 "2015-10-28T17:05:33Z")

</div>

Oh yes, I guess the error stems from the header snippet, try this:

```php
c::set('routes', array(
  array(
    'pattern' => 'sitemap',
    'action' => function() {
      $page = page('sitemap');
      $site = kirby()->site();
      tpl::load(kirby()->roots()->templates() . DS . 'sitemap', array('page' => $page, 'site' => $site), false);
    }
  ),
));

```

And in sitemap.php pass the variables to the snippet:

```php
snippet('header', array('page' => $page, 'site' => $site));

```

---

<div class="post-metadata">

**Author:** ![emilien](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/emilien/32/1135_2.png) [@emilien](https://forum.getkirby.com/u/emilien)\
**Post date:** [October 28, 2015, 5:09pm UTC](https://forum.getkirby.com/t/valid-url-without-folder-in-the-panel/2342/5 "2015-10-28T17:09:18Z")

</div>

working perfectly,  
thanks very much!

---

<div class="post-metadata">

**Author:** ![emilien](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/emilien/32/1135_2.png) [@emilien](https://forum.getkirby.com/u/emilien)\
**Post date:** [October 29, 2015, 8:09am UTC](https://forum.getkirby.com/t/valid-url-without-folder-in-the-panel/2342/6 "2015-10-29T08:09:06Z")

</div>

is it posible to do so with the error template?  
I mean removing the error folder and error.txt from the content folder,  
and still redirect non existing urls to the error.php template.

thanks

---

<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:** [October 29, 2015, 9:31am UTC](https://forum.getkirby.com/t/valid-url-without-folder-in-the-panel/2342/7 "2015-10-29T09:31:23Z")

</div>

Unfortunately not, the error folder must exist, otherwise Kirby throws an error.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:04pm UTC](https://forum.getkirby.com/t/valid-url-without-folder-in-the-panel/2342/8 "2025-02-06T17:04:19Z")

</div>


