# Install Kirby in a sub folder

**URL:** <https://forum.getkirby.com/t/install-kirby-in-a-sub-folder/3129>\
**Category:** Questions\
**Tags:** v2\
**Created:** [January 26, 2016, 9:35am UTC](https://forum.getkirby.com/t/install-kirby-in-a-sub-folder/3129 "2016-01-26T09:35:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [January 26, 2016, 9:35am UTC](https://forum.getkirby.com/t/install-kirby-in-a-sub-folder/3129/1 "2016-01-26T09:35:43Z")

</div>

I could not find any docs around this topic and htaccess problems are not my strong suit.

### Sub folder

I want to have all the Kirby files in a sub folder. I tried to move them in a folder called “cms”.

My localhost url looks like this: [http://localhost/megastore/cms/](http://localhost/megastore/cms/)

### Htaccess

```auto
RewriteBase /megastore/cms

```

When I visit the pages i come to urls like this: [http://localhost/megastore/cms/about](http://localhost/megastore/cms/about). Everything work and I guess it’s expected by what I have in my setup.

### Result

What I want is urls like this (“cms” removed):

[http://localhost/megastore/about](http://localhost/megastore/about)

### What I tried which failed

This failed

```auto
RewriteBase /megastore

```

### Conclusion

So… All Kirby files moved to “cms” folder should reflect in no changes on frontend and the panel.

Is it a htaccess problem or a routing problem?

Any ideas?

### UPDATE

I tried to add this in config.php. The the folder structure work, but the assets does not (because they link to the wrong urls).

```php
c::set('url','http://localhost/megastore');

```

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [January 26, 2016, 11:54am UTC](https://forum.getkirby.com/t/install-kirby-in-a-sub-folder/3129/2 "2016-01-26T11:54:35Z")

</div>

What about … moving Kirby to the `megastore` directory? Why do you need a subfolder if the content should be accessible without it in the end? 😉

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [January 26, 2016, 11:57am UTC](https://forum.getkirby.com/t/install-kirby-in-a-sub-folder/3129/3 "2016-01-26T11:57:39Z")

</div>

I want to have some scripts in the root. These scripts should not be dependent on Kirby so I don’t want to build them as plugins. When having both script and Kirby in the root it will be a messy root.

Maybe I’ll just do it the other way around, put the scripts in a folder instead.

---

<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 26, 2016, 11:59am UTC](https://forum.getkirby.com/t/install-kirby-in-a-sub-folder/3129/4 "2016-01-26T11:59:47Z")

</div>

That’s sounds like a more stable solution.

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [January 26, 2016, 11:59am UTC](https://forum.getkirby.com/t/install-kirby-in-a-sub-folder/3129/5 "2016-01-26T11:59:54Z")

</div>

Yes, I’d do it like that as well. Requests to existing PHP (and other) files are not intercepted by the Kirby `.htaccess`, so that shouldn’t be any problem and more robust.

---

<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, 4:58pm UTC](https://forum.getkirby.com/t/install-kirby-in-a-sub-folder/3129/6 "2025-02-06T16:58:06Z")

</div>

Archived on February 6, 2025, 4:58pm UTC


