Home  >  Article  >  Backend Development  >  apache rewrite 如果文件不存在就调转一个地址解决思路

apache rewrite 如果文件不存在就调转一个地址解决思路

WBOY
WBOYOriginal
2016-06-13 13:49:531102browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn