SSI Technic

SSI Technic

1. What are SSI
SSI(Server Side Includes) are directives that are placed in HTML pages. 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.

2. Configuring your server to permit SSI
SSI will use mod_include. So we should first enable this module on my ubuntu system.
>sudo a2enmod include

Change the configuration
>cd /etc/apache2/sites-available
>vi default
<Directory /var/www/>
             Options Indexes FollowSymLinks MultiViews +Includes
             AllowOverride None
             Order allow,deny
             allow from all
             AddType text/html .shtml
             AddOutputFilter  INCLUDES .shtml
</Directory>

3. sample html files to manage the layout of htmls
desk.shtml:
<html>
<head>
<title>E-Menu</title>
</head>
<body>
<!--#include virtual="common/header.shtml" -->
This is the body<br />
<!--#include virtual="common/footer.shtml" -->
</body>
</html>

And the other 2 files are as follow, header.shtml, footer.shtml:
This is footer<br />

This is header<br />

4. sample html files to show the parameters
env.shtml:
<!--#set var="name" value="sillycat" -->

desk.shtml:
<!--#cinlude virtual="common/env.shtml" -->
Hello, <!--#echo var="name" -->

references:
http://httpd.apache.org/docs/2.2/howto/ssi.html
http://jumu013.blog.163.com/blog/static/10316130020092310439198/
http://ubuntu.flowconsult.at/en/apache2-ssi-installation/
http://steveyoung.wordpress.com/2007/02/04/apache2-ssi-server-side-includes/

你可能感兴趣的:(apache,html,ubuntu,wordpress,cgi)