博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
在Apache下开启SSI配置
阅读量:4571 次
发布时间:2019-06-08

本文共 1247 字,大约阅读时间需要 4 分钟。

开启SSI:html、shtml页面include网页文件

 

使用SSI(Server Side Include)的html文件扩展名,SSI(Server Side Include),通常称为"服务器端嵌入"或者叫"服务器端包含",是一种类似于ASP的基于服务器的网页制作技术。默认扩展名是 .stm、.shtm 和 .shtml。

 

环境:Apache2.2 (httpd.conf文件)配置 html、shtml来include网页文件

1、 去掉AddType text/html .shtml ,AddOutputFilter INCLUDES .shtml前面注释

    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    AddType text/html .shtml .html
    AddOutputFilter INCLUDES .shtml .html

2、查找Options Indexes FollowSymLinks 在后面加上INCLUDES

注意,SSI确实可以利用shell来执行命令,这个功能是极度危险的,因为它会执行任何包含在exec标记中的命令。如果用户有可能修改你的网页内容,那么你一定要关闭这个功能。可以在Options指令中加上IncludesNOEXEC参数,以关闭exec功能,同时又保留SSI。

<Directory "E:/website">  #修改E:/website网站目录

#    Options FollowSymLinks

#    AllowOverride None
#    Order deny,allow
#    Deny from all
      Options FollowSymLinks INCLUDES IncludesNOEXEC
      AllowOverride None
</Directory>

3、重新启动apache ,ok你的html、shtml就可以加载页面了。

4、用include命令包含页面。

include元素能按file属性或virtual属性判断应该包含的文件。file属性是一个相对于当前目录的文件路径,即不能是一个绝对路径(以"/"开头)或包含"../"的路径。virtual属性可能更有用,它是一个相对于被提供的文档的URL ,可以以"/"开头,但必须与被提供的文档位于同一服务器上。

<!--#include virtual="/header.html" -->

转载于:https://www.cnblogs.com/freespider/p/4241482.html

你可能感兴趣的文章
kernel-char设备的建立
查看>>
DVWA-CSRF
查看>>
letecode [404] - Sum of Left Leaves
查看>>
ubuntu common software introduction
查看>>
资源相互引用时 需添加 PerformSubstitution=True
查看>>
MapRedece(单表关联)
查看>>
蒲公英App开发之检测新版本
查看>>
Android 中自定义控件和属性(attr.xml,declare-styleable,TypedArray)的方法和使用
查看>>
棋牌分布式架构
查看>>
【安卓基础】倒计时按钮封装(验证码倒计时按钮)
查看>>
configparser模块
查看>>
Crack的必备工具(2)
查看>>
SelectQueryBuilder的用法
查看>>
无法启动此程序,因为计算机丢失MSVCP120.dll
查看>>
jQuery EasyUI API 中文文档 - 表单(Form)
查看>>
代码格式化、着色工具之 UniversalIndentGUI
查看>>
原生JavaScript实现评分效果
查看>>
QT的学习
查看>>
将不才则三军倾
查看>>
nginx设置开机启动
查看>>