日期:2014-05-17  浏览次数:20434 次

apache下的一个rewrite
1:我的是zend环境,默认下除了一些静态资源都映射到index.php了
2:我有一个新的映射notice.html 想映射到content/index ,然后让content/index 再映射到index.php
我该怎么写呢?

RewriteEngine On 

RewriteRule notice\.htm$ content/index [NC,L]
RewriteRule !\.(gif|css|js|jpg|png|pdf|ico|html|php|swf|wmv)$ index.php [NC,L]

我发现这个规则是直接notice.html 映射到了index.php
而不是content/index 映射到了index.php

------解决方案--------------------
你是不是需要在notice.html文件夹下再建立一个.htacess文件。
如果在notice.html文件夹下没有建立的话,程序还是会走public下的.htacess.

具体原理的东西,你可以看看传智播客PHP视频教程 zend framework 第4讲 zend原理深度剖析。