• 在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" -->

  • 相关阅读:
    maven项目,去除jar包中的不想要的依赖关系
    Eclipse:An internal error occurred during: "Build Project". GC overhead limit exceeded
    如何用Maven创建web项目(具体步骤)
    让Jackson JSON生成的数据包含的中文以unicode方式编码
    MySQL存储过程详解 mysql 存储过程
    MySQL SQL Injection(注入)
    撤销Excel工作表保护密码(考勤机报表)
    youtube-dl下载视频
    LSI9240 8i在dos下刷IT直通模式
    制作DOS引导U盘(支持扩展任何dos下的程序)
  • 原文地址:https://www.cnblogs.com/freespider/p/4241482.html
Copyright © 2020-2023  润新知