zend和htaccess的问题


Problems with zend and htaccess

我正试图在共享的网络主机上制作一个Zend应用程序,我无法访问php.ini或任何内容。

Zend已经设置好并为索引控制器/视图工作。但是,当我试图通过说"mysite.com/About"来访问另一个控制器/视图时,我会得到这个错误:

Not Found
The requested URL /home/vhosting/g/vhostxx/domains/mysite.com/htdocs/projectname/public/index.php was not found on this server.

我的文件夹结构如下所示:http://framework.zend.com/wiki/display/ZFPROP/Zend+框架+默认+项目+结构+-+Wil+Sinclair(见第9点)

根目录中的.htaccess(/home/vhosting/g/vhostxx/domains/mysite.com/htdocs/projectname)看起来像这样:

php_value include_path "/domains/mysite.com/htdocs/www/library"
Options All -Indexes
php_flag display_errors on
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.mysite.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]

公用文件夹中的.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:

// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') :  'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
        ->run();

以及应用程序文件夹中的(空)引导程序:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
}

我试图访问的控制器是:projectname/application/controllers/AboutController.php应该可以通过mysite.com/About访问,但我收到了前面所说的消息。

我真的不知道我做错了什么,也不知道我错过了什么。有人能告诉我如何解决这个问题或如何调试这个问题吗?

附带说明:我的主机自动翻译

mysite.com/htdocs/projectname/

进入

mysite.com/htdocs/www/

在ftp上,不确定这是问题还是在通过http 访问时发生的

在公用文件夹中的htaccess文件中,更改:

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

包括一个前导斜杠:

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

Apache猜测重写规则的目标是什么,它是否是文件路径的URI路径,而且它似乎错误地猜测它是文件路径。你也可以在你的htaccess文件中添加一个基础:

RewriteBase /