@@ -97,3 +97,26 @@ of those:
9797.. literalinclude :: managing_apps/004.php
9898
9999Only when you change the Application Directory, see :ref: `renaming-app-directory ` and modify the paths in the **index.php ** and **spark **.
100+
101+ Changing the Location of the .env File
102+ ======================================
103+
104+ If necessary, you can change the location of the ``.env `` file by adjusting the ``$envDirectory ``
105+ property in ``app/Config/Paths.php ``.
106+
107+ By default, the framework loads environment settings from a ``.env `` file located one level above
108+ the ``app/ `` directory (in the ``ROOTPATH ``). This is a safe location when your domain is correctly
109+ pointed to the ``public/ `` directory, as recommended.
110+
111+ In practice, however, some applications are served from a subdirectory (e.g., ``http://example.com/myapp ``)
112+ rather than from the main domain. In such cases, placing the ``.env `` file within the ``ROOTPATH `` may expose
113+ sensitive configuration if ``.htaccess `` or other protections are misconfigured.
114+
115+ To avoid this risk in such setups, it is recommended to ensure the ``.env `` file is located outside any
116+ web-accessible directories.
117+
118+ .. warning ::
119+
120+ If you change the location of the ``.env `` file, make absolutely sure it is not publicly accessible.
121+ Exposure of this file could lead to compromised credentials and access to critical services, such as your
122+ database, mail server, or third-party APIs.
0 commit comments