An alternatives for the use of .htaccess in handling error is creating a configurable
php file that can be set upon the stages of development,production and testing just like other frameworks does.
* You can load different configurations depending on your
* current environment. Setting the environment also influences
* things like logging and error reporting.
*
* This can be set to anything, but default usage is:
*
* development
* testing
* production
*
* NOTE: If you change these, also change the error_reporting() code below
*
*/
define('ENVIRONMENT', 'development');
/*
*---------------------------------------------------------------
* ERROR REPORTING
*---------------------------------------------------------------
*
* Different environments will require different levels of error reporting.
* By default development will show errors but testing and live will hide them.
*/
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
break;
case 'testing':
case 'production':
error_reporting(0);
break;
default:
exit('The application environment is not set correctly.');
}
}
Or manually try to use ini_set() to properly set the configuration for error handling to on
// change settings for error handler to show errors
// $this setup is used for checking errors for development to be shown....
ini_set('display_errors', 1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
display_startup_errorsis going to be something people will want to set themselves. I wouldn't want a php framework to try and take control of the http server. Having said that, I don't know that theres an easy way to accomplish what you're talking about. htaccess is just a file of directives iirc.