I'm learning the Zend Framework and I setup my server in two ways.

One way was from a virtual host. Everything worked correctly, I added a custom controller for testing and it worked fine.

Now, when I try to run from an alias (http://localhost/test) I get this error:

Code:
Fatal error: Uncaught exception 'Zend_Controller_Action_Exception' 
with message 'Cannot redirect because headers have already been sent.' 
in C:\test\library\Zend\Controller\Action.php:192 Stack trace: #0 
C:\test\application\controllers\IndexController.php(15): 
Zend_Controller_Action->_redirect('/test') #1 
C:\test\library\Zend\Controller\Action.php(118): 
IndexController->noRouteAction() #2 
C:\test\library\Zend\Controller\Dispatcher.php(185): 
Zend_Controller_Action->run(Object(Zend_Controller_Dispatcher), 
Object(Zend_Controller_Dispatcher_Token)) #3 
C:\test\library\Zend\Controller\Dispatcher.php(136): 
Zend_Controller_Dispatcher->_dispatch(Object(Zend_Controller_Dispatcher_Token),
 true) #4 C:\test\library\Zend\Controller\Front.php(254): 
Zend_Controller_Dispatcher->dispatch(Object(Zend_Controller_Dispatcher_Token))
 #5 C:\test\library\Zend\Controller\Front.php(106): 
Zend_Controller_Front->dispatch() #6 C:\test\document_root\index.php(6): 
Zend_Controller_Front::run('C:/test/applica...') #7 {main} thrown in 
C:\test\library\Zend\Controller\Action.php on line 192
Now, this is from the IndexController which was taken from the Zend Framework manual:

Code:
<?php
                
require_once 'Zend/Controller/Action.php';

class IndexController extends Zend_Controller_Action 
{
    public function indexAction()
    {
        echo 'Hello from IndexController';
    }

    public function noRouteAction()
    {
		$this->_redirect('/');
	}
}

?>
Again, when I run this as a virtual host (test.fwork.com), everything works fine. This error only occurs when I'm running as a host.

Anyone have any ideas on this and how to fix it?