使用web.config允许HTML文件(IIS)中的服务器端包含 [英] Use web.config to allow server-side includes in HTML files (IIS)

查看:702
本文介绍了使用web.config允许HTML文件(IIS)中的服务器端包含的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IIS 7.5中,是否可以单独使用 web.config .html 扩展名的文件启用 SSI 处理?具体来说,我不想使用默认的SSI扩展名 .shtml

In IIS 7.5, is it possible to use web.config alone to enable SSI processing for files that have the .html extension? Specifically, I don't want to use the default SSI extension, .shtml.

原因:我不喜欢我想改变扩展名。这样做会导致搜索引擎结果中的链接断开。

Reason: I don't want to change the extensions. Doing so would lead to broken links in search engine results.

另外,我在 web.config 中执行此操作的动机是因为这是一个共享服务器

Also, my motivation for doing this in web.config is because this is a shared server.

推荐答案

假设您的主机已启用SSI的委托处理程序映射的读/写权限然后这应该工作:

Presuming that your hoster has enabled SSI's and delegated Read/Write permissions for handler mappings then this should work:

<configuration>
    <system.webServer>
        <handlers>
            <add name="SSINC-html" 
                 path="*.html" 
                 verb="*" 
                 modules="ServerSideIncludeModule" 
                 resourceType="File" 
                 requireAccess="Script" />
        </handlers>
    </system.webServer>
</configuration>

虽然我们讨论的是主题,但Robert McMurray(MSFT IIS职员)有一个相当近期的复习博客发布所有关于SSI的信息:

Whilst we're on the topic, Robert McMurray (MSFT IIS staffer) has a fairly recent refresher blog post all about SSI's here:


http://blogs.iis.net/robert_mcmurray/archive/2010/12 /28/iis-notes-on-server-side-includes-ssi-syntax-kb-203064-revisited.aspx

这篇关于使用web.config允许HTML文件(IIS)中的服务器端包含的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆