We use the ExpressionEngine CMS (php) to create websites. For each site, we set up a subversion repository and commit the EE installation as well as any custom templates, images
A lot of the configuration options could be dealt with by switching on $_SERVER['HTTP_HOST'].
For example
switch ($_SERVER['HTTP_HOST']) {
case 'developement.domain.com':
$api_key = "dev environment api key";
break;
default:
$api_key = "live environment api key";
}
Then for .htaccess issues you can set an alternate .htaccess file in your vhost definition using the AccessFileName directive:
ServerName sitename
AccessFileName .htaccess-dev