2

I have multiple web-apps running on a server using different technologies.

  • java
  • php (wordpress)
  • python (trac)

They are all front-ended with Apache 2.2. My question is does anyone know a good way to wrap all these web apps with a common template (header/footer).

I was looking into mod_layout, but the documentation is quite limited and I was unable to get even the simplest example to work.

I also looked at mod_include, but I'm not sure if that is a good idea.

delux247
  • 764
  • 1
  • 6
  • 12
  • I just got a simple example of mod_layout working, the problem was mod deflate had to be disabled –  Aug 20 '09 at 18:41
  • One more thing that I figured out is that if you want your header/footers to be java servlets then you need to use mod_jk and JkEnvVar to pase the mod_layout environment variables. - http://www.musc.edu/webserver/mod_layout.html#_1_15 - http://tomcat.apache.org/connectors-doc/reference/apache.html –  Aug 21 '09 at 14:57

1 Answers1

2

You can force all pages of a certain extension to include a header and footer by setting it out in the httpd.conf of the server, or just in the .htaccess of each particular directory/site with the append and prepend directives like so:

<FilesMatch "\.html$">
php_value auto_prepend_file /path/to/header.html
php_value auto_append_file /path/to/footer.html
</FilesMatch>

The above will match .html pages and will force include /path/to/header.html before the page content as well as /path/to/footer.html after the page.

Just remove the FilesMatch lines if you want to force it on all pages.

random
  • 450
  • 1
  • 9
  • 16