# Weird redirect happening with kirby on subfolder of site

**URL:** <https://forum.getkirby.com/t/weird-redirect-happening-with-kirby-on-subfolder-of-site/23162>\
**Category:** Questions\
**Tags:** v3\
**Created:** [August 17, 2021, 8:05pm UTC](https://forum.getkirby.com/t/weird-redirect-happening-with-kirby-on-subfolder-of-site/23162 "2021-08-17T20:05:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bruno](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bruno/32/6422_2.png) [@bruno](https://forum.getkirby.com/u/bruno)\
**Post date:** [August 17, 2021, 8:05pm UTC](https://forum.getkirby.com/t/weird-redirect-happening-with-kirby-on-subfolder-of-site/23162/1 "2021-08-17T20:05:42Z")

</div>

I’ve installed Kirby at a subdirectory of a client’s existing site:  
`www.example.at/mykirby`

this initial page load works and all assets are correctly loaded. However, every consecutive request (clicking a link, or a `fetch` request) is inserting `/en/` after the base URL resulting in a 404 on the main site, i.e `www.example.at/en/mykirby/data.json`

even manually entering `www.example.at/mykirby/de` (which should work because i have a multi lang install) auto redirects to `www.example.at/en/mykirby/de`

The main domain `example.at` also auto redirects to `example.at/en` on first load so I’m kind of assuming there is some server side language check happening in the background that leaks into Kirby.

I really don’t believe so, but is there _any_ possible way whatsoever that this is caused by Kirby itself? Never ran it from a subdomain, so I wanna make completely sure before I go annoy the person who set up the server.

edit: tried via phone where my language is set to german, and it redirects to “de”. maybe there’s some measures I can take myself? maybe even make use of the fact that en and de already exist as languages on the base server, maybe i can read these preferences and apply to the kirby install somehow…

---

<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:** [August 17, 2021, 9:31pm UTC](https://forum.getkirby.com/t/weird-redirect-happening-with-kirby-on-subfolder-of-site/23162/2 "2021-08-17T21:31:36Z")

</div>

I assume the main domain treats the subfolder as part of the main domain, but what exactly is happening and why highly depends on the server setup.

I’ve run Kirby successfully in subfolders, but depending on the server configuration ( `.htaccess`), rewrite rules, routes, auto-language detection and what not, this might fail.

Things you can try is set the URL in config.

Is there a reason why you don’t just point a subdomain to the subfolder?

---

<div class="post-metadata">

**Author:** ![bruno](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bruno/32/6422_2.png) [@bruno](https://forum.getkirby.com/u/bruno)\
**Post date:** [August 18, 2021, 4:51am UTC](https://forum.getkirby.com/t/weird-redirect-happening-with-kirby-on-subfolder-of-site/23162/3 "2021-08-18T04:51:13Z")

</div>

> [@texnixe](#):
>
> set the URL in config.

Done that!

> [@texnixe](#):
>
> Is there a reason why you don’t just point a subdomain to the subfolder?

Not from my point of view, but the person who manages the server wanted to use a subfolder instead… Will suggest again now.

---

<div class="post-metadata">

**Author:** ![Adspectus](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/adspectus/32/189_2.png) [@Adspectus](https://forum.getkirby.com/u/Adspectus)\
**Post date:** [August 18, 2021, 9:29am UTC](https://forum.getkirby.com/t/weird-redirect-happening-with-kirby-on-subfolder-of-site/23162/4 "2021-08-18T09:29:41Z")

</div>

Did you set the `RewriteBase` directive in your `.htaccess` in your `mykirby` subfolder to

```auto
RewriteBase /mykirby

```

and is it recognized at all?
