Auto detect internal/external development environment
We use the following function to auto detect if we are on a machine internally or on a live server and then choose the appropriate configs for various components: function devIsLocal(){ $res=false; $http_host=$_SERVER['HTTP_HOST']; if($http_host=='localhost')$res=true; if($http_host=='127.0.0.1')$res=true; if(substr($http_host,-4)=='.lan')$res=true; if(strpos($http_host, '.')===false)$res=true; return($res); } As you can see it only relies on the HTTP_HOST value. Of course, if you use some sort of virtual host locally like example.com then the function will be tricked. Are there any other ways