Good way to change in easy way application environment

Do you have problem with serve configurations for different environments (local,production) easy…


#.htaccess
SetEnvIf HOST ^(.*)aeonmedia\.eu\.?(:80)?$ APPLICATION_ENV=production
SetEnvIf HOST ^(.*)aeonmedia\.dev\.?(:80)?$ APPLICATION_ENV=development


#index.php, catch env default: production
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
echo APPLICATION_ENV;
exit;

example usage in CakePHP database configuration …