2012-04-30 29 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上只有一个重定向问题。

我不确定这是一个真正的问题还是我的问题,但现在会做。如果其他人有更多的信息,我很乐意听到它,但是这应该可以完成我的工作。