Here’s something everyone should add to their wp-config.php file if hosted with WP Engine:
How it Works
WP Engine loads up everyone’s wp-config.php files for their own wrangling — for optimization, SSL settings, and even hard-coding domains.
Part of the Copy from Production to Staging process is regenerating the wp-config.php with your staging site’s domain as the DOMAIN_CURRENT_SITE value. Here’s what the differences look like:
Production wp-config.php contains this:
Staging wp-config.php contains this:
So the code above says “if DOMAIN_CURRENT_SITE ends in .staging.wpengine.com, do …”
That’s why the code NEEDS to be placed below WP Engine’s initial defining of DOMAIN_CURRENT_SITE.
Basically, just scroll all the way to the bottom and place this code just before the “# That’s It. Pencils down” line.
Of course, you could invert the logic and have rules just for Production instead of or in addition to just for Staging.
An alternative method that may be preferred by some can be found at Paulund: Multi-Environment WordPress wp-config.php.
Now that you know how to have separate rules for WP Engine Production vs. WP Engine Staging, you might be looking for some more sweet wp-config.php hacks.
Not Yet Hosting with WP Engine? Just do it.
Click the image below to get started.