Subdomains from kirby folders

Using different pages of the same content directory is not recommended, because then the two sites will share the same site.txt and the templates and blueprints.

If you really want to do it this way (for example to maintain both sites from the same Panel account), you could create a plugin in the site/plugins directory that redirects either to kirby()->urls()->index() . '/one' or '/two' by checking the server name. Keep in mind that the URI will contain /one//two in this case.

The recommended way is to use a multi-site setup as described in the docs. You posted a snippet of this code, but maybe you didn’t understand correctly how it works: You would have two completely separate content and site directories, and their names would be the domains, not 1-one and 2-two. You would also have two different instances of the Panel with different users.

1 Like