当前位置:web 服务器 > IIS >>

IIS 不用 rewrite 实现页面静态化的方法

站长资源库提示:404有时候并不利于优化,不是万不得已建议安装rewrite软件


用rewrite做的静态页面实际不存在,iis(微软的WEB服务器平台)ewrite又不稳定经常404,于是就有了这篇文章。

原理:404页面类型用php(做为现在的主流开发语言)(Asp也可以),结合小偷,实现页面静态化

用discuz!论坛archiver举例:

error.php(做为现在的主流开发语言)源码:

$url = $_SERVER[QUERY_STRING];
$url = str_replace("404;","",$url);
if (!ereg (archiver, $url))
echo "404错误";
//404错误页面显示内容
else {
$url = str_replace("archiver/","archiver/?",$url);
$str = file("$url");
$count = count($str);
for ($i=0;$i<$count;$i++){
$file .= $str[$i];
}
echo $file;
//实现archiver/?xx.html 变成archiver/xx.html
}
?>

补充:Web开发 , php ,
Apache
IIS
Nginx
Tomcat
如果你遇到web 服务器难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,