2012-04-30 28 views
3

我已經在今天晚上設置了zend,並且默認的索引頁工作(http://home.mitheren.com/399a4/public/)。我從那以後嘗試在該控制器上添加一個新的Action,但我一直收到404錯誤。Zend重寫規則不起作用

這是公共/目錄我的.htaccess文件:

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

當我嘗試訪問該頁面(http://home.mitheren.com/399a4/public/index/testing)我得到一個404錯誤,並在/ var下面的消息/日誌/的Apache2/error.log中:

[Mon Apr 30 21:44:30 2012] [error] [client 192.168.1.254] File does not exist: /var/www/399a4/public/index.php/testing 

我也試着重寫記錄,並在訪問該頁面得到如下條目:

192.168.1.254 - - [30/Apr/2012:21:46:54 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9e6020/subreq] (3) [perdir /var/www/399a4/public/] add path info postfix: /var/www/399a4/public/index.php -> /var/www/399a4/public/index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:46:54 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9e6020/subreq] (3) [perdir /var/www/399a4/public/] strip per-dir prefix: /var/www/399a4/public/index.php/testing -> index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:46:54 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9e6020/subreq] (3) [perdir /var/www/399a4/public/] applying pattern '^.*$' to uri 'index.php/testing' 
192.168.1.254 - - [30/Apr/2012:21:46:54 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9e6020/subreq] (4) [perdir /var/www/399a4/public/] RewriteCond: input='/var/www/399a4/public/index.php' pattern='-s' => matched 
192.168.1.254 - - [30/Apr/2012:21:46:54 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9e6020/subreq] (1) [perdir /var/www/399a4/public/] pass through /var/www/399a4/public/index.php 
192.168.1.254 - - [30/Apr/2012:21:46:54 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9cdf80/initial] (3) [perdir /var/www/399a4/public/] add path info postfix: /var/www/399a4/public/index.php -> /var/www/399a4/public/index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:46:54 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9cdf80/initial] (3) [perdir /var/www/399a4/public/] strip per-dir prefix: /var/www/399a4/public/index.php/testing -> index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:46:54 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9cdf80/initial] (3) [perdir /var/www/399a4/public/] applying pattern '^.*$' to uri 'index.php/testing' 
192.168.1.254 - - [30/Apr/2012:21:46:54 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9cdf80/initial] (4) [perdir /var/www/399a4/public/] RewriteCond: input='/var/www/399a4/public/index.php' pattern='-s' => matched< 
192.168.1.254 - - [30/Apr/2012:21:46:54 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9cdf80/initial] (1) [perdir /var/www/399a4/public/] pass through /var/www/399a4/public/index.php 

.htaccess文件肯定正在處理中(AllowOverride已打開,並且通過添加變量並檢查php信息進行檢查)。

UPDATE:更改規則以什麼維陶塔斯建議給了我這個產量在重寫日誌:

192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ddff0/subreq] (3) [perdir /var/www/399a4/public/] add path info postfix: /var/www/399a4/public/index.php -> /var/www/399a4/public/index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ddff0/subreq] (3) [perdir /var/www/399a4/public/] strip per-dir prefix: /var/www/399a4/public/index.php/testing -> index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ddff0/subreq] (3) [perdir /var/www/399a4/public/] applying pattern '^/399a4/public/.*$' to uri 'index.php/testing' 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ddff0/subreq] (3) [perdir /var/www/399a4/public/] add path info postfix: /var/www/399a4/public/index.php -> /var/www/399a4/public/index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ddff0/subreq] (3) [perdir /var/www/399a4/public/] strip per-dir prefix: /var/www/399a4/public/index.php/testing -> index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ddff0/subreq] (3) [perdir /var/www/399a4/public/] applying pattern '^/399a4/public/.*$' to uri 'index.php/testing' 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ddff0/subreq] (1) [perdir /var/www/399a4/public/] pass through /var/www/399a4/public/index.php 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ec050/initial] (3) [perdir /var/www/399a4/public/] add path info postfix: /var/www/399a4/public/index.php -> /var/www/399a4/public/index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ec050/initial] (3) [perdir /var/www/399a4/public/] strip per-dir prefix: /var/www/399a4/public/index.php/testing -> index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ec050/initial] (3) [perdir /var/www/399a4/public/] applying pattern '^/399a4/public/.*$' to uri 'index.php/testing' 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ec050/initial] (3) [perdir /var/www/399a4/public/] add path info postfix: /var/www/399a4/public/index.php -> /var/www/399a4/public/index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ec050/initial] (3) [perdir /var/www/399a4/public/] strip per-dir prefix: /var/www/399a4/public/index.php/testing -> index.php/testing 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ec050/initial] (3) [perdir /var/www/399a4/public/] applying pattern '^/399a4/public/.*$' to uri 'index.php/testing' 
192.168.1.254 - - [30/Apr/2012:21:59:14 +1000] [home.mitheren.com/sid#7f1ffd754120][rid#7f1ffd9ec050/initial] (1) [perdir /var/www/399a4/public/] pass through /var/www/399a4/public/index.php 


更新2:出於測試目的,我添加了另一個控制器(稱爲試驗),(http://home.mitheren.com/399a4/public/test)這完美地工作。這意味着我的重寫規則至少有一些工作?

更新3:排序解決! 我在我的第二個測試控制器上創建了更多的視圖,並且它們都正常工作。看來,我的IndexController上只有一個重定向問題。我不確定這是一個真正的問題還是我的問題,但它現在會做。如果其他人有更多的信息,我很樂意聽到它,但是這應該可以完成我的工作。

+0

嘗試設置虛擬主機。 –

回答

0

解決了!我在第二個測試控制器上創建了更多視圖,並且它們都工作正常。看來,我的IndexController上只有一個重定向問題。

我不確定這是一個真正的問題還是我的問題,但現在會做。如果其他人有更多的信息,我很樂意聽到它,但是這應該可以完成我的工作。