Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
 Discussion Forums
 HTML, XML, JavaScript...
 Software Reviews
 Editors,Others...
 Top100
 JavaScript Tutorials, ...
 Tutorials
 ASP, CSS, Databases...
 Discussion List
 FAQ, Roundup, Configure ...
 Authoring
 HTML, JavaScript, CSS...
 Design
 Layout, Navigation,...
 Graphics
 Tools, Colors, Images...
 Software
 Browsers, Editors, XML...
 Internet
 Domains, E-Commerce, ...
 WDVL Resources
  Intermdiate, Tutorials,...
 WDVL
 Discussion Lists, Top 100,...
 Technology Jobs

PDAs
PC Notebooks
Printers
Monitors


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us
Desktop Computers
Compare Prices
Server Racks
Online Shopping
Memory Upgrades
Cell Phones
Find Software
Computer Deals
Imprinted Promotions
Prepaid Phone Card
Promos and Premiums
GPS
Promotional Pens
Web Hosting Directory

Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


  Rethinking the Datacenter
Sponsored by HP
Today's datacenters need to increase utilization, get control over power and cooling costs, and align with business objectives. Download this eBook to learn about the challenges facing the data center in a world where digital information is growing at a torrid pace and costs are being held in check. Learn more. »
 
  Putting the Green into IT
Sponsored by HP
Electricity use in data centers is skyrocketing, sending energy bills through the roof, creating environmental concerns and generating negative publicity. "Going Green" means looking to technologies like virtualization, energy-efficient chips and racks, and implementing policies that extend beyond the data center. Learn more. »
 
  Managing the Modern Network
Sponsored by HP
In a global economy where information crosses the globe in an instant, and where Web-based applications power business, it's more important than ever to ensure your network is safe from threats and optimized to deliver the data your business needs. »
 
  Evaluating Software as a Service for Your Business
Sponsored by Webroot
Is Software as a Service just hype, or is something really going on here? See if your company can benefit as SaaS tries to change the face of the enterprise. »
 
  Is Your Disaster Recovery Plan Good Enough?
Sponsored by HP
Preparing for a disaster is more often than not part of the storage planning process, and it is one of the most difficult tasks, since it includes local hardware and software, networking equipment, and a test plan. Learn how to get disaster recovery right. »
 
Top 10 Articles
  1. Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
  2. JavaScript Tutorial for Programmers
  3. Design
  4. JavaScript Tutorial for Programmers - Objects
  5. JavaScript Tutorial for Programmers - JavaScript Grammar
  6. JavaScript Tutorial for Programmers - Versions of JavaScript
  7. Cascading Style Sheets
  8. JavaScript Tutorial for Programmers - Embedding JavaScript
  9. JavaScript Tutorial for Programmers - Functions
  10. Authoring JavaScript
Domain Name Lookup
Search to find the availability of a domain name. Just enter the complete domain name with extension (.com, .net, .edu)

Server Side Includes

May 8, 2000

Are you the harried, overworked web-designer who just learned the boss wants across the board changes to a thousand page website? Go ahead, look distressed, ask for a raise and then make the changes in just a few minutes using Server Side Includes. (installation required - batteries not included)

Note: Not all of the SSI commands will work on your server. It depends on what type of server you have and the server configuration.

What are Server Side Includes and what can I do with them?

Server-side Includes will run on most, but not all servers. They were first introduced in the NCSA server; Apache has taken it a step farther with eXtended Server-side Includes. Unfortunately, they will not run on CERN.

An SSI is a command or directive placed in an HTML file through the use of a comment line. With a simple SSI command you can update an entire site design, dynamically add the current time and date or the date a file was last modified, execute shell and CGI scripts and more! A definite boon to web developers who are short on funds and time and over worked with a gazillion pages to manage.

How to enable

Includes can be "turned on" by editing either the server's configuration files or adding an .htaccess file to the directory you want to enable includes in.

  • Server Configuration

    If you have access to your servers configuration files you can enable SSI with a small edit to the access.conf and srm.conf.

    Telnet into your server, navigating to the directory where your configuration files are located. This may be something like usr/local/etc/httpd/conf/. Using your favorite text editor, open srm.conf and locate the following lines:

    # If you want to use server side includes, or CGI outside
    # ScriptAliased directories, uncomment the following lines.
    
    #AddType text/x-server-parsed-html .shtml
    #AddType application/x-httpd-CGI .CGI
    

    You may or may not have the commented instruction lines, but what you're looking for are the two lines that start with AddType. You need to remove the # from in front of them.

    Save your changes and move on to access.conf. You'll need to locate the section of this file that deals with specifying which directory should be set as DocumentRoot. You will probably find something similar to the section below, although it may have other settings between the <Directory> and </Directory> tags.

    # This should be changed to whatever you set DocumentRoot to.
    
    <Directory /usr/local/etc/httpd/htdocs>
    
    # This may also be "None", "All", or any combination of "Indexes",
    # "Includes", or "FollowSymLinks"
    
    Options Indexes FollowSymLinks Includes
    
    </Directory>
    
    

    If you do not wish to allow scripts or shell commands to be run add IncludesNOEXEC to the options line. This will allow SSIs but not CGI or shell commands.

    Note: In the latest version Apache there is one file that contains all of the config stuff.. the httpd.conf. You can make all of the above edits in this one file.

  • .htaccess

    If you don't have access to your server config files, all is not lost. Create a file with your favorite text editor, naming it .htaccess. (Yes, the (.) is important. It tells your server that this is a hidden file that can't be seen by the casual snoop). Add the following three lines to your .htaccess file.

    Options Indexes FollowSymLinks Includes
    AddType application/x-httpd-CGI .CGI
    AddType text/x-server-parsed-html .shtml	
    

    .htaccess should be uploaded to the directory you want to protect. All sub-directories inside that directory will also be protected. If you wish to exclude CGI or shell commands on a per directory basis you can add the IncludesNOEXEC to the options line in the .htaccess file.

    Why .shtml? Can't I use .html?

    A file that contains includes must be parsed by the server. This puts an extra load on the server but unless your site receives [millions] of visitors a day it's unlikely you'll notice a slow-down in load time. Still, if you're not using includes to add the headers and footers to your entire site there's really no need to parse every single page. If your plan is to just add a few includes to special pages, give them a file extension of .shtml and the server will parse only those pages. On the other hand, if you have an existing site of multiple pages, plan to use includes to add headers and footers and don't look forward to renaming all of your files to .shtml you can add the line

    AddType text/x-server-parsed-html .html
    to your .htaccess file instead. All of your pages will be parsed, but they'll need to be anyway to grab those headers/footers.

Contents:

SSI Syntax
The config directive
   Time/Date Formats
Includes
Printing Environment Variables with echo
CGI Environment Variables
CGI Environment Variables cont.
Printing page stats

SSI Syntax


Up to => Home / Authoring / SSI




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers