Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Trying to get apache server-side includes to work. Really simple - just want to include a footer on each page.

Apache 2.2:

# ./httpd -v
Server version: Apache/2.2.21 (Unix)
Server built:   Dec  4 2011 18:24:53
Cpanel::Easy::Apache v3.7.2 rev9999

mod_include is compiled in:

# /usr/local/apache/bin/httpd -l | grep mod_include
  mod_include.c

And it's in httpd.conf:

# grep shtml httpd.conf
AddType text/html .shtml
DirectoryIndex index.html.var index.htm index.html index.shtml index.xhtml index.wml index.perl index.pl index.plx index.ppl index.cgi index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml default.htm default.html home.htm index.php5 Default.html Default.htm home.html
AddHandler server-parsed .shtml
AddType text/html .shtml

In the web directory I created a .htaccess with

Options +Includes

And then in the document, I have:

<h1>next should be the include</h1>
<!--#include virtual="/footer.html" -->
<h1>include done</h1>

And I see nothing in between those headers. Tried file=, also with/without absolute path.

Is there something else I'm missing?

I see the same thing on another unrelated server (more or less stock CentOS 6), so I suspect the problem is between keyboard and chair...

share|improve this question
    
If you have PHP available, you can rename the document from file.html to file.php and just add <?php include('footer.html'); ?> instead of <!--#include virtual="/footer.html" -->. Everything else would stay exactly the same. –  ionFish Apr 22 '12 at 15:00
    
Yep, know all about PHP :-) Was trying to avoid using the overhead in this case by using apache's SSI since it's just static content. –  raindog308 Apr 22 '12 at 15:10
add comment

closed as off topic by Anagio, danlefree Oct 30 '12 at 22:00

Questions on Webmasters Stack Exchange are expected to relate to webmastering within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

From my WampDeveloper (Wamp package) configuration:

<IfModule include_module>
<Directory "C:/WampDeveloper/Websites/*/webroot">
Options +Includes
AddOutputFilter INCLUDES .html .shtml
</Directory>
</IfModule>

You probably are missing the AddOutputFilter directive that assigns file extensions to be processed by the SSI filter or are using an incorrect AddHandler filter-name.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.