Windows Server 2008 IIS7安装SSI服务器端包含

要是没安装SSI,访问.shtml会报错

HTTP 错误 404.3 - Not Found
由于扩展配置问题而无法提供您请求的页面。如果该页面是脚本,请添加处理程序。如果应下载文件,请添加 MIME 映射。

计算机--右键--管理 打开 服务器管理器

1.添加角色服务

 

2.选择 在服务器端的包含文件

 

样例

index.shtml

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>首页index</title>
</head>
<body>
首页index
<!--#include virtual="head.shtml"-->
<!--#include file="head.shtml"-->
</body>
</html>
head.shtml
<div>
	头部div
</div>
 

<!--#include file="head.shtml"--> 可以写相对路径,参考:

http://happyqing.iteye.com/blog/2211945

把这两个文件放到C:\inetpub\wwwroot下

要确定你的文件的本身的编码是UTF-8就不会乱码,

效果

 

猜你喜欢

转载自happyqing.iteye.com/blog/2213498