It appears that it is not currently possible to install the latest Magento Community Edition within a subdirectory (or there are steps required, which are not in the Documentation that I can find?) with a fresh install.
I have tested this 3-4 times in the last 2 days. If you install it into the root it works as anticipated, if you install it in a subdirectory - the install says it has worked but the index.php is missing and the .htaccess file is still the default one that comes with the composer project setup.
This works for root folder:
--base-url="http://www.fieldhockey.co"
This does not work for the subdirectory:
base-url="http://www.fieldhockey.co/store"
All the other setup:install parameters are the same in both attempts.
I found little about this issue so that is why I have created this - perhaps someone can try this out on a different setup than mine:
Cent OS 7.9 (v92.0.10)
PHP 7.3.27
Apache 2.4.46
My Question(s)
So my questions on the back of this issue - how do I then move the installation to a subdirectory? And is it correct that there is no index.php - even when the install works in the root and the site displays?
Updating the base_url in the database to include it and moving all files into that directory and then clearing the cache & reindexing does not work?
Just out of curiosity - I took the default index.php script and .htaccess from a site I setup on 2.4.1 back in November... and now my store works in the subdirectory after moving the files from the root directory (but the admin cannot load any CSS etc or 2FA so I cannot login).
UPDATE - 19/02/2021 - 13:24pm (GMT)
I think the issue is the install itself not the subdirectory - to test this theory I will install 2.4.1 and see if I get better results.
UPDATE - 19/02/2021 - 15:10pm (GMT)
2.4.1 successfully installed in root, both front end and backend are working. I will now attempt to move the site into the store directory manually. If that fails I will attempt to install it to the subdirectory directly.
UPDATE - 19/02/2021 - 15:52pm (GMT)
Moving worked thou came across an issue I hadn't seen mentioned before regarding the JS/CSS breaking when relocating to a new directory. There is a .htaccess file in the /pub/static/ directory which doesn't seem to be created when a new static folder is generated - so you probably shouldn't rename the /pub/static/ directory to force it to be regenerated.Magento 2.4.1 - Moved site to a subdirectory - CSS & JS Broken - cleared Cache still broken [SOLVED]
SO ANYONE ANY IDEAS?
At this stage I cannot understand why 2.4.1 is working but 2.4.2 isn't - I cannot see any mention in the release notes pertaining to a non optional module or version of anything significant (PHP, Apache, ElasticSearch, Composer etc)
I can keep it on 2.4.1 but it isn't really the point, I should be able to use 2.4.2 is I want to and have the means to do so?
I hope this helps anyone else trying to do this, I will work with 2.4.1 for a few weeks and then try to upgrade again.