Roots Discourse

Bedrock on WPEngine

I have this project that needs to be deployed on WPEngine. I have dozens of other Bedrock projects on shared hosting but I can’t just copy my usual workflow.

In this particular case, I’m deploying with deployHQ which works like a charm. All dependencies are added and build files are generated on deployHQ’s servers and then migrated to the WPEngine server.

On other shared hosting, I always have a .htaccess file to load the web/index.php file. It would typically look similar to this:

RewriteCond %{REQUEST_URI} !web/
RewriteRule (.*) /web/$1 [L]

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /web
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Edit

WPEngine only uses the .htaccess file when using php 7.3, and will stop supporting this in the near future. Currently, when I’m testing the above .htaccess file with php7.3, I receive the wordpress white screen of death for the homepage. The /admin page forwards and loads the /wp/wp-login.php page, but all other requests from that page (css, js, images, …) get a 404 response (despite having a correct path and being there on the server).

From php7.4, WPengine has “redirect rules” that you could set in their admin panel.
I think (not sure) it should work if I translate those rules to WPEngine rules (they use common Regex).

Right now, I have 1 redirect rule in WPEngine with source ^/(?!web\/)(.*)?$ (which should ignore requests to the web directory) and destination /web/$1.

Does anyone here know

  1. If it is even possible to run Bedrock on Wpengine, with htaccess?
    and
  2. If it would work, how to set those redirect rules?