1 - set a variable in the config to specify production / deveploment
'application' => [
'siteUrl' => 'https://something.net',
'controllersDir' => APP_PATH . '/app/controllers/',
'modelsDir' => APP_PATH . '/app/models/',
'viewsDir' => APP_PATH . '/app/views/',
'baseUri' => '/',
'production' => false,
2 - When now use this variable in the service.php to configure the controller . If its in production 404 if not, phalcon debug mode will be on on the index.php
$di->set('dispatcher', function() use ($di, $config) {
$dispatcher = new PhDispatcher();
$dispatcher->setDefaultNamespace('Naruhodo\Controllers');
//in production
if($config->application->production)
{
//set event for 404
$evManager = $di->getShared('eventsManager');
$evManager->attach(
'dispatch:beforeException',
function($event, $dispatcher, $exception)
{
switch ($exception->getCode()) {
case PhDispatcher::EXCEPTION_HANDLER_NOT_FOUND:
case PhDispatcher::EXCEPTION_ACTION_NOT_FOUND:
default:
$dispatcher->forward(
array(
'controller' => 'error',
'action' => 'show404'
)
);
return false;
}
}
);
$dispatcher->setEventsManager($evManager);
}
return $dispatcher;
},
true
);
3- Base url I would use something similar to supernovagurl .
Let me know if you need any more help ;)