我有5台运行FreeBSD 9.2的生产服务器,但是我们正在计划转换到CentOS。 正因为如此,我正在尝试使用CentOS 6.6来设置一些虚拟机来模拟我们的生产服务器环境。 我已经设置了一切,它的效果很好,保存一个重写规则。
<Directory /var/www/html/www/trunk/amapi> RewriteEngine on RewriteRule ^$ public/ [L] RewriteRule (.*) public/$1 [L] </Directory> <Directory /var/www/html/www/trunk/amapi/public> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L] </Directory> <Directory /var/www/html/www/trunk> RewriteCond %{THE_REQUEST} ^[AZ]{3,9}\ /.*start\.php RewriteRule ^start.php/?(.*)$ $1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ start.php/$1?%{QUERY_STRING} [L] </Directory>
前两个重写规则适用于使用Phalcon的后端API,并且在两种环境中都可以很好地工作。 第三个重写规则是将所有不匹配真实文件的请求redirect到start.php,它会尝试将它们匹配到一个Phalcon模块,如果没有匹配的路由,则返回到404页面。
由于某种原因,它运行在运行Apache 2.2.27的FreeBSD下,而不是在目前运行Apache 2.2.15的CentOS下运行。 这是一个非常简单的重写规则,它应该可以在任何版本的Apache下工作,但是在尝试访问文件时,apache会一直抛出404。 我错过了什么吗? 显示的代码显然缺lessSSLconfiguration和特定的选项,但这些是请求者在ssl.conf中出现的顺序。
提前致谢
更新:Apache重写日志是:
10.1.1.135 - - [24/Feb/2015:17:39:17 --0500] [trunk.mydomain.com/sid#7f18f3072f98][rid#7f18f36099b8/initial] (2) init rewrite engine with requested uri /letters/custom/test 10.1.1.135 - - [24/Feb/2015:17:39:17 --0500] [trunk.mydomain.com/sid#7f18f3072f98][rid#7f18f36099b8/initial] (3) applying pattern '^/attc2/(.*)$' to uri '/letters/custom/test' 10.1.1.135 - - [24/Feb/2015:17:39:17 --0500] [trunk.mydomain.com/sid#7f18f3072f98][rid#7f18f36099b8/initial] (3) applying pattern '^/forms/(.*)$' to uri '/letters/custom/test' 10.1.1.135 - - [24/Feb/2015:17:39:17 --0500] [trunk.mydomain.com/sid#7f18f3072f98][rid#7f18f36099b8/initial] (3) applying pattern '^/grafx/(.*)$' to uri '/letters/custom/test' 10.1.1.135 - - [24/Feb/2015:17:39:17 --0500] [trunk.mydomain.com/sid#7f18f3072f98][rid#7f18f36099b8/initial] (3) applying pattern '^/xport/(.*)$' to uri '/letters/custom/test' 10.1.1.135 - - [24/Feb/2015:17:39:17 --0500] [trunk.mydomain.com/sid#7f18f3072f98][rid#7f18f36099b8/initial] (3) applying pattern '.*' to uri '/letters/custom/test' 10.1.1.135 - - [24/Feb/2015:17:39:17 --0500] [trunk.mydomain.com/sid#7f18f3072f98][rid#7f18f36099b8/initial] (4) RewriteCond: input='' pattern='!.*mydomain.com/.*$' [NC] => matched 10.1.1.135 - - [24/Feb/2015:17:39:17 --0500] [trunk.mydomain.com/sid#7f18f3072f98][rid#7f18f36099b8/initial] (4) RewriteCond: input='/letters/custom/test' pattern='\\.(jpg|gif|png)$' => not-matched 10.1.1.135 - - [24/Feb/2015:17:39:17 --0500] [trunk.mydomain.com/sid#7f18f3072f98][rid#7f18f36099b8/initial] (1) pass through /letters/custom/test