2012-01-12 44 views
1

我正在使用wamp。我想使用SSI,所以我有些改變在httpd.conf線,但它似乎並不奏效:wamp ssi不工作

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

的test.html

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

menu.shtml

<h1>hheelloo</h1> 

我在想什麼?

回答

0

我認爲這可能工作,而不是< - #include文件:

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

我也有這個在我將AddType text/html的的.shtml行:

AddOutputFilter INCLUDES .shtml 

FYI我我不是專家,我只是看着我自己的服務器是如何建立的。我希望它能幫助

+0

我試過@pete它仍然不工作:( – Shruti 2012-01-12 15:30:02

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. 

按照這些步驟爲我工作。

5

添加到您的項目根目錄下面的一個.htaccess文件。

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

這應該允許包括在該項目上工作。

+0

快速簡單!謝謝 – kellycode 2015-01-05 16:35:22

+0

工作就像一個魅力謝謝:) – 2016-06-04 15:02:21