MultiSite in Subdirectory, Page not found

So, I made a clean install of Grav core + Admin plugin into my http://localhost/test/ which is working and showing the default page.

I copied the content of setup_subdirectory.php from the docs into setup.php i my root folder “test”.
I then created test/user/sites/subsite/user/ and in there placed config, pages, plugins, themes that I copied from the base user-dir.

When I visit http://localhost/test/subsite I get a Error 404, page not found message.

Could someone point me in the right direction?
I’ve read all the docs about this and all forum posts that I could find about Multisite and still can’t find a solution to this.

If using Apache, do you have .htaccess in the Grav root folder?

Yes, I’m using to run my local server and I have the .htaccess in the Grav root folder. I haven’t changed anything from the default settings.

I’m also having the same problems.

This is a problem I have also struggled with for a while.

I did a quick test, it seems that the setup.php picks /test as your subsite. You need to run it in your root domain (e.g. localhost/subsite). You can check this by adding an

echo ROOT_DIR . "user/{$folder}"; exit();

inside the

if (!$name || !is_dir(ROOT_DIR . "user/{$folder}")) {


You’ll see it’s returning /your-path-htdocs/user/sites/test and not /your-path-htdocs/test/user/sites/subsite.

You can change your setup, or tweak how the folder is calculated in the setup.php file.

Thank you for pointing in the right direction. It got me halfway there, I think.

I replaced $name = Folder::shift($path);with $name = basename($path);and that made it fetch the subsite instead of test and displayed the home page for subsite.

The remaining issue for me now is that if I create another normal page in my pages-folder under subsite it is not found when I point to localhost/test/subsite/another-page-for-subsite

It seems to be working better when I place the website directly in http://localhost/ and not in a subfolder. Silly me.