View Single Post
  #1 (permalink)  
Old 12-26-2007, 10:30 PM
GeoffreyB GeoffreyB is offline
Junior Member
 
Join Date: Dec 2007
Location: Mornington, Victoria Australia
Posts: 3
Send a message via Skype™ to GeoffreyB
Default Problem with ZF URL

I am a real newbie. I am having a problem with ZF URLs.

Setup: Apache has an alias to the iris/html directory in my development area. My directory structure for this application is -
Code:
iris/application/controllers
                               /models
                               /views/filters
                                        /helpers
                                        /scripts/error
                                                  /index
                                                  /user
              /html/images
                      /scripts
                      /styles
              /library
.htaccess file in iris/html reads:
Code:
RewriteEngine on
RewriteRule !\\.(js|ico|gif|jpg|png|css)$ index.php
index.php is in iris/html and reads:
Code:
<?php
/**
 * My new Zend Framework project
 *
 * @author
 * @version
 */

set_include_path('.' . PATH_SEPARATOR . './library' . PATH_SEPARATOR . './application/models/' . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Controller/Front.php';
error_reporting( E_ALL | E_STRICT );

/*
 * Register an autoload() callback.  This is optional but very handy.
 */
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

$appDir = dirname(dirname(__FILE__)) . '/application';
Zend_Registry::set('appdir', $appDir);

$config = new Zend_Config_Ini("$appDir/etc/config.ini",'main');
Zend_Registry::set('config', $config);


/*
 * This application uses a database, and our config file contains some
 * parameters to connect to the database.  Once we create this database
 * adapter, save it in the registry and also tell the table class where
 * to find it.
 */
$db = Zend_Db::factory(
    $config->database->adapter,
    $config->database->params->toArray()
);

/*
 * The database we're using has utf-8 characters, so encode them properly
 */
$db->query('SET NAMES utf8');

/*
 * Save this database connection in a place where other classes can find it.
 */
Zend_Registry::set('defaultDb', $db);
Zend_Db_Table::setDefaultAdapter('defaultDb');
/**
 * Setup controller
 */
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory("$appDir/controllers");
$controller->throwExceptions(true); // should be turned on in development time

// run!
$controller->dispatch();
My problem is that to access the index page I have to type the full url -
Code:
http://localhost/iris/index.php
Code:
http://localhost/iris/
gives me a
Code:
400 Bad Request

Your browser sent a request that this server could not understand.
response.
Like wise from the login form
Code:
<form name="form1" method="post" action="/iris/user/login">
produces the same 400 response.
Has anyone got some ideas about what I can do to fix this.
Reply With Quote