1

我使用 MAMP 开发网站。我在 htdocs 文件夹中拥有自己的文件夹中的每个站点。我管理一个需要使用 ssi 指令的站点,因为主机不允许 php 包含。

我在 httpd.conf 文件中取消了对这些行的注释:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

我在 htdocs 文件夹中添加了一个 .htaccess 文件,其中包含以下内容:

AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes

在站点索引页面上,包含使用:

<!--#include file="top-nav.shtml" -->

但它不适用于任何子文件夹中的文件。我收到此错误:

[an error occurred while processing this directive] 
4

2 回答 2

2

我发现在这些设置过程之后 SSI 仍然失败的最常见原因是default 8888在浏览器中调用本地网页时未指定端口 ( )。

请参阅:http ://documentation.mamp.info/en/mamp/first-steps

于 2012-11-30T09:02:57.200 回答
1

事实证明,使用virtual而不是file在子目录上工作。我仍然不确定是否有任何特殊原因file不起作用。该问题已在serverfault.com上得到解答。

该线程可在此处获得:https ://serverfault.com/questions/214096/how-to-enable-ssi-for-all-html-files

于 2010-12-19T06:13:00.620 回答