开发者

Zend framework URL index

I installed Zend framework 1.11.5 I have Wamp 2.2 and running windows7.

I have a folder (mysite) inside apache documentRoot('c:/wamp/www');'mysite' folder structure is:

/application
   /controllers
        IndexController.php
   /views
      /scripts
        index.phtml
   bootstrap.php
/library
/public
   /css
   /images
   /javascript
   .htaccess
   index.php

Issue: If I point the browser to 'http://localhost/mysite/public/' I can see my index page correctly.But if I point to 'http://localhost/mysite/public/index/' or 'http://localhost/ejoin2ED/public/index/index' I see the Wampserver configuration page (I tought this is the output of another page I have, 'index.php' inside 'c:/wamp/www开发者_C百科' ).

Shouldnt I see the content of index.phtml instead??

thanks

Luca

.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]

index.php

//identify the location of th application dir in respect to 
//the botstrap file's location, and configure PHP's include_path to
//include the library directory's location

define('APPLICATION_PATH',realpath(dirname(__FILE__).'/../application/'));
set_include_path(APPLICATION_PATH.'/../library'.PATH_SEPARATOR.
get_include_path());

//give the zend framework the ability to load classes on demand,
//as you request them,rather than having to deal with require() statements.

require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();

//retrieve the BOOTSTRAP file
try
{
require'../application/bootstrap.php';  
}
catch(Exception $exception)
{
printf('Could not locate bootstrap.php');
exit(1);    
}

//start using the front controller in order to route all requests
Zend_Controller_Front::getInstance()->dispatch();

bootstrap.php

//configure the site environment status

defined('APPLICATION_ENVIRONMENT')
or define('APPLICATION_ENVIRONMENT','development');

//invoke the front controller
$frontController=Zend_Controller_Front::getInstance();

//identify the location of the controller directory
$frontController->setControllerDirectory(APPLICATION_PATH.'/controllers');

//create the env parameter so you can later access the environment
//status within the application

$frontController->setParam('env',APPLICATION_ENVIRONMENT);

//clean up all allocated script resources
unset($frontController);


There is a problem with your htaccess file.

The slash at index.php is the problem

RewriteRule ^.*$ /index.php [NC,L] 

Should be

RewriteRule ^.*$ index.php [NC,L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜