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.

2

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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