Background Back when I got my GL-AR150 mini router, I was blown away by the powerful capabilities of this $25 OpenWRT router,...
Simple development / production configuration management in WordPressStanislav Khromov
I’ve seen a few posts about managing multiple WordPress configuration files in dev / prod environments. (Such as this one.) Many of them seem a bit over-engineered, so why make it more complicated than it has to be? Here is probably the fastest way to setup different configuration files for development and production environments in WordPress:
- Copy wp-config.php twice, as wp-config.dev.php and wp-config.prod.php
- Create a new wp-config.php file, input the snippet below:
<?php /* Config loading based on environment variable */ if(getenv('WP_ENV') === 'dev') include 'wp-config.dev.php'; else include 'wp-config.prod.php';
- In your VirtualHost configuration, set the appropriate environmental variable.
SetEnv WP_ENV dev
SetEnv WP_ENV prod
- You’re done!