magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Consistant Location for index.php File

Open astorm opened this issue 13 years ago • 8 comments

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)

astorm avatar Sep 07 '13 22:09 astorm

:thumbsup: I agree with Alan. The inclusion of /pub was obvious to me but would likely be nonobvious for many.

philwinkle avatar Sep 07 '13 22:09 philwinkle

@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).

antonmakarenko avatar Mar 19 '14 16:03 antonmakarenko

I think Magento 2 should has one index.php in pub directory. It's more secure.

ihor-sviziev avatar Mar 20 '14 07:03 ihor-sviziev

Internal ticket: MAGETWO-32660

vpelipenko avatar Feb 23 '15 12:02 vpelipenko

What is the status of the internal ticket?

amenk avatar Sep 25 '15 16:09 amenk

See also https://github.com/magento/magento2/issues/1874

amenk avatar Sep 25 '15 16:09 amenk

No update since September of last year -- assuming this isn't a priority for the engineering team and closing out.

astorm avatar Aug 23 '16 19:08 astorm

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.

piotrekkaminski avatar Aug 23 '16 21:08 piotrekkaminski