I'm using the .htaccess redirect from the ZF manual and there are no header or other redirects in the code.
I'm really stumped by this. Any ideas ?
Thanks in advance
Moderator: General Moderators
Code: Select all
<?php
/**
* Bootstrap file for HUB Application
*
* For ZF 0.9.1 including incubator
*/
/*
* The basics...
*/
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 1); //disable on production servers!
date_default_timezone_set('Europe/London');
/*
* Setup the include_path to the ZF library.
* We set the incubator first so the
* incubator classes are loaded in preference
* to core ZF classes where two versions exist.
*/
$include_path = '/home/editpc/hubdata/library/incubator/library'.PATH_SEPARATOR.'/home/editpc/hubdata/library';
set_include_path($include_path);
/*
* Include the Zend_Loader
*/
require_once 'Zend/Loader.php';
/*
* Autoload magic php function... avoids the need to include class files manually.
* This will also be available in all files included beyond this point.
*
* In this file Zend_Loader will be used... elsewhere __autoload will be used.
*/
function __autoload($class_name){
if(!class_exists($class_name,false)){
$class_path = str_replace('_',DIRECTORY_SEPARATOR,$class_name);
require_once($class_path.'.php');
}
}
/*
* Get the config data from our config.ini file and store in registry
*/
Zend_Loader::loadClass('Zend_Config_Ini');
$config = new Zend_Config_Ini('/home/editpc/hubdata/data/config.ini', 'staging');
Zend_Registry::getInstance()->set('config', $config);
/*
* Load and register our View for later use
*/
Zend_Loader::loadClass('Zend_View');
$view = new Zend_View();
$view->setScriptPath($config->base_path.'application/views');
Zend_Registry::getInstance()->set('view', $view);
/*
* Load and register our database for later use.
*/
$params = array ('host' => $config->database->host,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->name);
Zend_Loader::loadClass('Zend_Db');
$db = Zend_Db::factory($config->database->type, $params);
Zend_Registry::getInstance()->set('db', $db);
/*
* Instantiate a Request to set BaseURL
*/
Zend_Loader::loadClass('Zend_Controller_Request_Http');
$request = new Zend_Controller_Request_Http();
$request->setBaseUrl($config->base_url);
/*
* Setup and run the Front Controller
*
* Set Controller Dir, dispatch the modified Request (with updated BaseURL) and finally
* get the resulting Response object.
*/
$controller = Zend_Controller_Front::getInstance();
$controller->throwExceptions(true);
$controller->returnResponse(true);
$controller->setControllerDirectory($config->base_path.'application/controllers');
$response = $controller->dispatch($request);
/*
* By default Exceptions are not displayed
* That won't do during development.
* Remove this in a live environment!
*
* $response->renderExceptions(true); will not
* work, it's a bit broken and was fixed in SVN for
* next release. Until then...manually echo exception
*/
if($response->isException())
{
echo $response->getException();
exit; // Stop here - ;)
}
/*
* Echo the response (with headers) to client
* Zend_Controller_Response_Http implements
* __toString().
*/
echo $response;
?>Code: Select all
<?php
/**
* HUB Application IndexController
*
* This is the indexController for the HUB Application. It will handle all
* requests to the main index of the application.
*
* @category HUB
* @package controller
* @copyright Copyright (c) 2007 Lee Conlin
*/
class IndexController extends Zend_Controller_Action
{
public function IndexAction()
{
/*
* Get View from Registry
*/
$view = Zend_Registry::getInstance()->get('view');
/*
*Assign view data
*/
$view->page_title = ':: Index';
/*
* Lets use a Response object to collate
* any output.
* No need to set headers unless output is
* not text/html (PHP default)
*/
$this->getResponse()->setBody(
$view->render('index.tpl.php')
);
}
}
?>Code: Select all
<?php
/**
* HUB Application LoginController
*
* This is the LoginController for the HUB Application. It will handle all
* login and user management.
*
* @category HUB
* @package controller
* @copyright Copyright (c) 2007 Lee Conlin
*/
class LoginController extends Zend_Controller_Action
{
public function indexAction()
{
/*
* Get View, DB and config from Registry
*/
$view = Zend_Registry::getInstance()->get('view');
$db = Zend_Registry::getInstance()->get('db');
$config = Zend_Registry::getInstance()->get('config');
/*
*Assign view data
*/
$view->page_title = ':: Login';
$view->formAction = $config->base_url.'login/login';
/*
* Lets use a Response object to collate
* any output.
* No need to set headers unless output is
* not text/html (PHP default)
*/
$this->getResponse()->setBody(
$view->render('login_form.tpl.php')
);
}
}
?>Code: Select all
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
php_flag register_globals off
php_flag magic_quotes offCode: Select all
object(Zend_Controller_Request_Http)#7 (13) {
["_requestUri:protected"] => string(6) "/login"
["_baseUrl:protected"] => string(27) "http://editpc.servehttp.com"
["_basePath:protected"] => NULL
["_pathInfo:protected"] => string(0) ""
["_params:protected"] => array(0) {
}
["_aliases:protected"] => array(0) {
}
["_dispatched:protected"] => bool(false)
["_module:protected"] => NULL
["_moduleKey:protected"] => string(6) "module"
["_controller:protected"] => NULL
["_controllerKey:protected"] => string(10) "controller"
["_action:protected"] => NULL
["_actionKey:protected"] => string(6) "action"
}