在Apache下开启SSI配置
2017-06-15 22:10
363 查看
在Apache下开启SSI配置
开启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" -->
相关文章推荐
- 在Apache下开启SSI配置
- Apache下开启SSI配置使html支持include包含的方法
- Apache下开启SSI配置使html支持include包含
- 在Apache下开启SSI配置
- Apache开启SSI配置以及针对shtml开启apache相关设置
- shtml页面include网页文件Apache开启SSI配置
- shtml页面include网页文件Apache开启SSI配置
- 在Apache下开启SSI配置支持include shtml html和快速配置服务器
- Apache下开启SSI配置使shtml支持include包含
- Apache下开启SSI配置使shtml支持include包含
- apache2.0x开启gzip压缩和http缓存的配置方法
- apache服务器ssi支持配置
- 修改Apache配置文件开启gzip压缩传输
- 让Apache支持cgi、SSI、shtml的配置方法
- windows 下 apache 动态缓存 ssi 配置
- Apache配置开启支持.htaccess
- apache配置ssi支持shtml
- Apache下实现ssi的配置方法
- apache开启虚拟主机功能与httpd-vhosts.conf 配置分享
- SHTML简介及Apache配置ssi功能