Adding Server Environment variables from .htaccess

Posted by & filed under Odds.

Say you want to do something like this…

if ($_SERVER['LOCAL_DEV']){
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    Mage::setIsDeveloperMode(true);
} else {
    error_reporting(E_ALL | E_STRICT);
}

You just need to get .htaccess to set that environment variable by adding this line:

SetEnvIf Server_Addr ^127\.0\.0\.1$ LOCAL_DEV=1