Paths and folders

On PHP webhosting, the root path is /var/www/[domain]/ and public_html is the webroot; Symfony and Laravel must be configured to use it as the root folder.

The path to the root folder on PHP webhosting plans is /var/www/[domain]/

If you need to access the public_html folder, the path will therefore be /var/www/[domain]/public_html/

Webroot / document root

Files and folders that are to be displayed on the website must be placed in the public_html folder, which must be located in the root folder. It is not possible to change this.
Files placed outside the public_html folder cannot be accessed by browsers/visitors.

Start files

On a PHP webhosting plan, your start file (the file that is read when a user visits www.ditdomæne.dk) must be named one of the following:

  1. index.php
  2. index.phtml
  3. index.shtml
  4. index.htm
  5. index.html

The files are read in the order above, so the ones listed first have higher priority than the remaining ones.
Remember that file names are case-sensitive, so Index.php is not the same as index.php.

Symfony

By default, Symfony uses the public folder as the root folder (Document-Root), and not public_html, as our servers do.

You need to change Symfony's public folder to public_html as described in the Symfony documentation on changing the public folder.

Laravel

By default, Laravel uses the public folder as the root folder (DocumentRoot), and not public_html, as our servers do.

To solve this, you can either change the Laravel configuration so that it uses the public_html folder instead of public, or you can create a so-called symlink from public to public_html.
You can create a symlink with the command ln -s public public_html via SSH. Please note that the public_html folder must not already exist when you create the symlink.

Article from the support category: PHP