【发布时间】:2018-01-07 10:49:42
【问题描述】:
我正在使用 USBWebServer(Apache、PHP、MySql)在本地开发一个网站,我想使用 SSI,所以我可以包含页眉、页脚等内容。
在我的 .htaccess 中,我放置了以下指令:
Options +Includes
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
我有主 index.shtml,里面有指令:
<!--#include virtual="./files/navbar.shtml" -->
<!--#include virtual="./files/contact.shtml" -->
而且效果很好。
但是,当我将网站上传到我的网络服务器时,使用 .htaccess 中的相同指令,index.shtml 不能包含任何内容。
我目前的解决方法是将 index.shtml 更改为 index.php 并使用 php 包括:
<?php
virtual('./files/navbar.shtml');
?>
,但我想知道为什么 SSI 在服务器上不能按预期工作,我该怎么做才能使它与 .shtml 一起工作?
【问题讨论】:
标签: php apache include ssi server-side-includes