1

我正在与 wamp 合作。我想使用 ssi,所以我在 httpd.conf 中更改了以下几行,但它似乎不起作用:

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

测试.html

<html>
<title>This is incl html</title>
<!--#include file="menu.shtml" -->
</html>

菜单.shtml

<h1>hheelloo</h1>

我错过了什么?

4

3 回答 3

7

使用以下内容将 .htaccess 文件添加到您的项目根目录。

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

这应该允许包括在该项目上工作。

于 2014-09-01T18:58:11.690 回答
1

在找到此链接之前,我遇到了同样的问题-

http://www.roseindia.net/tutorial/php/phpbasics/Setting-Up-SSI-On-Wamp.html

答案的要点如下。似乎需要将这些行添加到文件中的特定位置。他们还建议在 FollowSymLinks 选项上查找和替换 -

How to add SSI (Serverside include support in WAMP)?
Open http.conf file from <your drive):\wamp\bin\apache\Apache2.2.11\conf (e.g. C:\wamp\bin\apache\Apache2.2.11\conf)
Then add the following code:
AddType text/html .shtml
Options +Includes
AddOutputFilter INCLUDES .shtml
**The above code should be above "<Directory />" in httpd.conf file**
Then find "Options Indexes FollowSymLinks" and replace it with:
Options +Indexes +FollowSymLinks +Includes
Restart wamp and enjoy.

遵循这些步骤对我有用。

于 2012-11-26T19:47:33.883 回答
0

我认为这可能有效,而不是 < !--#include 文件:

<!--#include virtual="menu.shtml" -->

我的 AddType text/html .shtml 行下也有这个:

AddOutputFilter INCLUDES .shtml

仅供参考,我不是专家,我只是看看我自己的服务器是如何设置的。我希望它有帮助

于 2012-01-12T14:51:11.227 回答