|
|||
|
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
Code:
RewriteEngine on RewriteRule !\\.(js|ico|gif|jpg|png|css)$ index.php 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();
Code:
http://localhost/iris/index.php Code:
http://localhost/iris/ Code:
400 Bad Request Your browser sent a request that this server could not understand. Like wise from the login form Code:
<form name="form1" method="post" action="/iris/user/login"> Has anyone got some ideas about what I can do to fix this. |
|
|||
|
Thank you. This has fixed another issue, the /styles/style.css file is now being applied.
I can now access the index page using http://localhost/iris/index but still not via http://localhost/iris/ and likewise the other pages eg http://localhost/iris/user/login. Apache error.log doesn't help too much Code:
[Fri Dec 28 13:34:07 2007] [error] [client 127.0.0.1] Invalid URI in request GET /iris/ HTTP/1.0 [Fri Dec 28 13:37:29 2007] [error] [client 127.0.0.1] Invalid URI in request POST /iris/user/login HTTP/1.0, referer: http://localhost/iris/index.php Geoffrey |
|
|||
|
I have the exact same setup with an Alias and running into the very same problem. I can get to the page fine via http://localhost/alias/index.php, but getting 400 Bad Reqests on any other requests such as http://localhost/alias/ or http://localhost/alias/index/index.
Any ideas? |
|
|||
|
Thanks a heap.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|