我有一個.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