Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Header & footer (.htaccess)

Status
Not open for further replies.

stormbind

Technical User
Mar 6, 2003
1,165
GB
Hi,

How can I apply a header & footer to all pages of a certain filetype using *only* .htaccess?

Thank you :)

----------
Memoria mihi benigna erit qui eam perscribam
 
Seemed like a logical thing to be able to do :/

Doesn't .htaccess support scripting of any kind?

----------
Memoria mihi benigna erit qui eam perscribam
 
No. You could use server side includes (ssi) for that, but you'd still have to put the include directives in your pages.
 
Yeah, that's what I have at the moment. It isn't very convenient and bloats search indexes.

----------
Memoria mihi benigna erit qui eam perscribam
 
The other option would be to go with some sort of templating engine, either writing a simple one yourself or using an available product.

You could use mod rewrite to take a URL: to
maintemplate.php could be as simple as:

Code:
<?php
include( 'header.html' );
include( $_GET[ "request" ] ); // with some error handling
include( 'footer.html' );
?>
 
Yeah, SSI can in Apache 4.x can better than by using path_info

domain.com/template/query.file (where query is the page)

Sadly, however, my host provides only Apache 3.x :(

----------
Memoria mihi benigna erit qui eam perscribam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top