Consistant Location for index.php File
As it stands, Magento 2 currently ships with two index.php bootstrap files. One in the root folder
index.php
and one in the pub folder
pub/index.php
This situation creates some uncertainty for end users of the system as to which folder should be exposed to their web-server. The includes of a pub folder will indicated to some developers that this should be the public webroot. However, developers not familiar with the concept will see index.php in the root folder and assume this file should be exposed.
With commenting on which approach is better, a single approach should be chosen for the file to reduce confusion in the system. A single location for the "index bootstrap" files should be chosen, and stuck to. (assuming, of course, there's is not an opaque-but-important reason for the current state of affairs)
:thumbsup: I agree with Alan. The inclusion of /pub was obvious to me but would likely be nonobvious for many.
@astorm @philwinkle
Both index.php are entry points and they are reusing the same app/bootstrap.php
The intended use cases:
- The root index.php -- for those who deploy the entire Magento code base into a web-accessible location. For example, into the "document root" or a subdirectory under document root. This use case is inherited from Magento 1 and it is typical for a shared hosting environment
- The pub/index.php -- if you are able to configure the "pub" directory as the document root. In order to run a Magento 2 web application, the "pub" directory is the only one that's necessary to expose. The rest you can hide (typically for security reasons, to avoid accidental exposing local.xml or something like that).
I think Magento 2 should has one index.php in pub directory. It's more secure.
Internal ticket: MAGETWO-32660
What is the status of the internal ticket?
See also https://github.com/magento/magento2/issues/1874
No update since September of last year -- assuming this isn't a priority for the engineering team and closing out.
Hey @astorm. I do understand the confusion it introduces and while we have plans to have single entry point, it is not a priority due to low impact and possibility of affecting many merchants using lower end hosting providers, who still (s)FTP the files and cannot change the webroot. Ideally everyone that can should be using pub as the entry point and I will ask to clarify this in the guides.