Store Kirby CMS files in a separate directory to root but have Kirby pages appear to be in root

So I have an existing site with static PHP pages.

I now want to add Kirby CMS to a separate directory. Perhaps /cms

I then want to add two pages - /news and /recruitment

I want these to appear in my root as and but obviously as I’ve added my Kirby files to a separate directory, it’s showing as and

I am trying to avoid re-doing my whole site to include Kirby CMS in the root.

Any ideas?

You could try moving Kirby’s index.php and .htaccess files into the webroot, then proceed with a “custom folder setup”. Point all relevant folders to __DIR__ . '/cms', like:

$kirby = new Kirby([
    'roots' => [
        'index'   => __DIR__ . '/cms',

This should get you started, I don’t know about the URLs that will then be generated (when calling $page->url() or $image->thumb(...), for example), those will probably require some more configuration

What you are trying to do is often referred as “mapping remote content into the local namespace” and can be achieved by accessing the given (remote or local) content via a reverse proxy.

I you are using Apache (with mod_proxy_html and dependent modules activated) and having access to the virtual host configuration file, you could use the following additional directives (for the page to be accessed by

  SSLProxyEngine on
  ProxyRequests off
  RequestHeader unset Accept-Encoding
  ProxyHTMLEnable on
  ProxyHTMLExtended On
  ProxyHTMLURLMap "/cms/news" "/news" [R]
  ProxyPass "/news" ""
  ProxyPassReverse "/news" "/cms/news"

This will fetch the content accessed by /news from /cms/news and replace existing links in the news page which refers to /cms/news by /news.

This can be extended by more links and other replacements depending on your needs.

Kirby and its panel is still available at and resp.