Talk:KB / Web Programming / CGI, PHP, and Databases / SSI: Server-Side Includes
From DreamHost
A customer asked about(and solved) how to handle nest SSI with CGI:
Just wanted to let you know I figured out what the problem was and how to solve it. Here's what was happening:
- The html file was calling an SSI of:
This SSI worked fine because the html page's extension was valid for doing
SSI calls.
- In /lh/common/copyright.txt it called an SSI of:
In Apache 2.x this worked fine. On your Apache 1.3 it didn't make this SSI
call. Here's my guess as to why it didn't work in 1.3. The .txt extension
isn't, by default, a valid extension to make SSI calls. To fix this I
created a .htaccess file in /lh/common with this line:
AddHandler server-parsed .txt
After adding this both SSI calls work.
My guess is that in Apache 2.x the only requirement is that the original file making the SSI call has a valid extension. Every subsequent nested SSI call, regardless of where it is or its extension, will be executed. In 1.3 things must be configured properly down the entire SSI nested chain, that either all files must have a valid extension or you need to put the AddHandler statement in the .htaccess file located in the same directory as the file making the SSI call.