Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

MultiSite in Subdirectory, Page not found

Started by Muut Archive 10 years ago · 7 replies · 683 views
10 years ago

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.

10 years ago

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

10 years ago

Yes, I'm using https://laragon.org/ to run my local server and I have the .htaccess in the Grav root folder. I haven't changed anything from the default settings.

10 years ago

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

10 years ago

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}")) {

check.

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.

10 years ago

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

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1350 9 years ago
Archive · by Muut Archive, 9 years ago
2 934 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2947 9 years ago
Archive · by Muut Archive, 9 years ago
3 1118 9 years ago