用rewrite做的静态页面实际不存在,iisewrite又不稳定经常404,于是就有了这篇文章。
原理:404页面类型用PHP(Asp也可以),结合小偷,实现页面静态化
用discuz!论坛archiver举例:
404程序页面:http://bbs.pkxp.com/error.php
演示:http://bbs.pkxp.com/archiver/
error.php源码:
1
2$url = $_SERVER['QUERY_STRING'];
3$url = str_replace("404;","",$url);
4if (!ereg ('archiver', $url))
5echo "404错误";
6//404错误页面显示内容
7else {
8$url = str_replace("archiver/","archiver/?",$url);
9$str = file("$url");
10$count = count($str);
11for ($i=0;$i<$count;$i++){
12$file .= $str[$i];
13}
14echo $file;
15//实现archiver/?xx.html 变成archiver/xx.html
16}