I\'d like to automatically change my database connection settings on a per-vhost basis, so that I don\'t have to edit any PHP code as it moves from staging to live and yet a
The problem with .htaccess is that it is part of the code base tree. And the code base tree is part of VC/SVN. Hence any change in local/dev gets moved to production. Keeping the env variable setting in httpd.conf saves you the effort of being careful about not accidentally overwriting the server vs dev flag. Unless of course you want to do with IP address or host name, both of which are not scalable approaches.