Published on

Change document root of DDEV based TYPO3

Authors

I was recently asked how to change the docroot of a TYPO3 composer-based install while using DDEV.

This short article shows everyone how to do that — we will change the doc root from public to html. Stop DDEV completely before making the changes.

Adjust the composer.json

This assumes you have an installation set up as described in the TYPO3 installation guide. Add the following extra section to your composer.json:

{
  "extra": {
    "typo3/cms": {
      "web-dir": "html"
    }
  }
}

Adjust the DDEV configuration

Switch the docroot in the DDEV config (ddev/config.yaml):

docroot: html

Now run ddev start and composer update — done!

Your composer.json is not in your project root?

If you want to change where DDEV looks for your composer.json and executes composer-related commands, take a look at the composer_root setting available in DDEV 1.19.0: