Root path
The root path refers to the directory that serves as the entry point for public requests from the world wide web.
Per default all the domains of the environment will route to the same root path (sometimes this is also called: document root, docroot or root folder): htdocs. This path is where the first index.php will be called, when people are visiting your App on any domain. This path setting can vary, depending on what the framework or CMS you have selected in the software chooser when creating the app.
You can however set the root path afterwards at any given time by tinkering with .htaccess to enable per domain routing.
# Plain default
In a typical old school PHP project, the root path is on top level and contains the index.php file, which is the default script to be executed.
www <-- Root path ├── index.php <-- file to be called ├── css/ ├── js/ ├── images/ ├── includes/raw
index.php: Main entry pointincludes/: PHP scripts included
# Modern root path settings
For a better file structure and increased security, it is recommended to keep most PHP files outside the publicly accessible directory and use a folder as the document root:
www ├── public/ <-- Root path │ └── index.php <-- file to be called ├── src/ ├── vendor/ └── composer.jsonraw
public/: Public-facing filessrc/: PHP source codevendor/: Composer dependencies
By configuring the public/ directory, you prevent direct web access to sensitive files in src/ and vendor/. This pattern is standard for all modern PHP frameworks and CMS:
public- Laravel, Statamic, October CMS …web- Craft CMS …
# Root path setting on fortrabbit
On fortrabbit you can set the root path for each environment with the routing settings in the dashboard. When choosing a software template the correct root path will pre-configured.
Found a tpyo?Edit