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

apache rewrite 如果文件不存在就调转一个地址
rewrite   可不可以做条件判断呀。
我想这样,如果一个静态文件(html)存在,就跳转的这个地址,
如果不存在就跳转到指定的php   文件,但这个文件应该不是404指定的文件

------解决方案--------------------
html和php同名吗? 还是一个php对应多个html?
------解决方案--------------------
可以这样: RedirectMatch 404 some.*\.html$ http://www.anotherserver.com/what.php
你学习一下应该就能满足你的具体业务.
http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch