Q. I would like to use Server Side Include (SSI) from my html pages. But it is not working for VirtualHost. How do I configure Apache Server Side Include?
A. From Aapache site, "SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or other dynamic technology".
Make sure you have following configuration directive/line in your .htaccess or httpd.conf file:
vi /etc/httpd/httpd.conf
OR
vi .htaccess
Add following directive:
Options +Includes
Above directive (Options +Includes) tells Apache that you want to permit files to be parsed for SSI directives.
Next, make sure Apache knows which files should be parsed using SSI.
AddType text/html .shtml
AddHandler server-parsed .shtml
Now test your configuration by adding any one of the following SSI directive:
$ vi test.shtml
Append any one of the following SSI directive:
<!--#echo var="DATE_LOCAL" -->
OR
<!--include file="counter.cgi"-->
Save the file. Restart Apache and test your configuration.
For more information see Apache SSI tutorial
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- My 10 UNIX Command Line Mistakes
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email FAQ to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: 08/27/06


{ 0 comments… add one now }