186-0984-0880
 
apache开启ssi
日期:09-29 浏览次数:17

2种方法开启apache中ssi,使得apache支持ssi

在httpd.conf中修改
1:
找到#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
去掉前面的#

2,在网站根目录下加入以下代码,即可开通ssi
在根目录(虚礼目录)中加---
#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
Options Includes FollowSymLinks MultiViews
# ~~~~~~~~ <= INCLUDES 启动shtml脚本中用
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

(新浪发布新闻差不多的)例子:站点根目录为(虚礼目录):F盘
在f盘下面建立公用调用数据库文件,header.php
header.php:
echo "这里是header部分输出的文字";
?>
由后台生成静态页面: F:/html/2008/11/5/173710234.shtml
另外在f:/下建立,x.shtml
x.shtml:

浏览可以得出:这里是header部分输出的文字

上方就是一个简单的ssi技术实例

173710234.shtml:

浏览出错,因为file命令只能调用相对根目录下的文件,简单的说能往下包含,不能往上包含。

173710234.shtml:

浏览可以得出:这里是header部分输出的文字

比较得到,file和virtual的不同。
   file 指定包含文件相对于本文档的位置
   virtual 指定相对于服务器文档根目录的位置

通过以上2中方法既可让apache开启ssi功能

← 上一篇 下一篇 → 返回首页
如有意向,请联系我们的客户经理
我们会根据您的需求为你制定详细的解决方案
在线咨询 or 拨打业务热线:186-0984-0880
在线咨询
热线电话
解决方案
扫一扫

扫一扫
关注新图闻科技

全国咨询热线
186-0984-0880

返回顶部