Forced to move .env, /config & /vendor to data folder

Hi! Thanks for reading.

All set to go into production and our client’s hosting provider offers a cheap shared hosting with no chance to write on the root folder. The only alternative is to move the .env, /config and /vendor folders into a “data” folder. I managed to connect the db updating the wp-config.php path:

require_once(dirname(DIR) . ‘/data/vendor/autoload.php’);
require_once(dirname(DIR) . ‘/data/config/application.php’);

The problem is that all the contents in the app folder are not found, no plugins, no themes. Is there anything we can do or we’d better move to a conventional WP installation?

Thanks in advanced and keep up the good work!

Cheers!

M

Although it’s not an identical scenario, reworking Bedrock’s file structure has been covered here and here.

If you’ve made all the changes and it’s still not working then you’ll need to debug (check read permissions etc).

Hi, many thanks for the quick reply Foxaii. In the end we decided to change the hosting with no problem.

Cheers!

Hi! It’s been a while… just came across a similar scenario:

Folder structure example:

  • data
  • .env
  • config
    • application.php
    • environments
  • vendor
  • web
  • app
  • index.php
  • wp
  • wp-config.php

Update the wp-config.php path:

require_once(dirname(DIR) . ‘/data/vendor/autoload.php’);
require_once(dirname(DIR) . ‘/data/config/application.php’);

Update the application.php $webroot_dir path:

/** @var string Document Root */
$webroot_dir = $root_dir . ‘/…/web’;

Hope this helps…

Cheers!