CRAFT_BASE_PATH problems when installing Craft 3 in subdirectory My client wants Craft 3 installed in a subdirectory of the main site. So I placed it in http://mainsite.com/subdir.

The issue now is that the webroot for the domain is at http://mainsite.com, so my Craft index.php isn't being hit when I go to http://mainsite.com/subdir since it's further down in the /web folder.

I'm trying to pull my index.php out of /web and into the /subdir directory by setting a custom CRAFT_BASE_PATH, but I've tried several different paths to no avail.

The error is simply: "This page isn’t working. mainsite.com is currently unable to handle this request. HTTP ERROR 500"

My directory structure is: 

var/www/html/subdir/
├── craft/
│   └── config, vendor, templates, .env, web etc
├── index.php


But if it would be better if I stuffed index.php back into /web and went about this a different way I'm all ears. I'm not the network admin, so if there is a way to set a custom root for a subdirectory on the server or something, I'll have to ask someone else to do it for me, which is fine if that's the best way to do it.
If I understand correctly, take the content of web and place it in subdir so you have:

html/
├── subdir/
│   └── craft/ (config, vendor, templates, .env etc)
│   └── cpresources
│   └── .htaccess
│   └── index.php
└── the main site


Then in index.php do :

define('CRAFT_BASE_PATH', dirname(__DIR__) . '/subdir/craft');

And you should have your craft site accessible at mainsite.com/subdir