我有一个.htaccess
文件看起来像这样:Zend框架控制器加载失败之谜
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
如果我浏览到我的网站我有,测试说http://www.example.com/,索引页加载正确。
这是Zend框架应用程序,因此它应该路由的事情了我的控制器,因为它不正确,如果我去http://www.example.com/index/index或http://www.example.com/index,指定控制器+动作,只是在控制器。
如果我做了一些像http://www.example.com/index/test这样的工作,我在索引控制器上定义了另一个名为test的动作。
但是,如果我做一个TestController.php
文件,并试图去http://example.com/test/,Apache是返回:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /path/to/website/root/public/index.php was not found on this server.</p>
<hr>
<address>Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.4.6 PHP/5.2.4-2ubuntu5.10 with Suhosin-Patch Phusion_Passenger/2.0.3 mod_perl/2.0.3 Perl/v5.8.8 Server at www.example.com Port 80</address>
</body></html>
有人能看到我在这里搞砸了?
Billy3
编辑:我的网站的配置看起来像:
Alias /MySiteRoot/ "/usr/local/vsites/something/www/"
<Directory /usr/local/vsites/something/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
如果mod_rewrite并没有,为什么'HTTP:// www.example.com /索引/ index'正常工作?为什么'/ path/to/website/root/public/index.php'存在,尽管Apache抱怨相反? – 2010-01-17 02:16:17
编辑我的问题 - AllowOverride所有列出:( – 2010-01-17 02:27:30
有趣的 - 如果我关闭'.htaccess'中的'MultiViews'选项,那么甚至没有'http:// www.example.com/index/index'工作正常。我怀疑我的index.php在这一点上有一些权限问题。 – 2010-01-17 03:19:30