DelphiFAQ Home Search:

Enabling SSI (server side includes) on Apache


comments37 comments. Current rating: 4 stars (8 votes). Leave comments and/ or rate it.


I have a file home.shtml in which I added a server side include ( but it does not work.


If the script runs fine from the shell, then most likely your web hosting company or your server's administrator has not enabled server side includes.
You can enable it in Apache's configuration file which is typically located in:

If you have no write privilege on that file, you can enable SSI for a selected directory only (it will apply to all subdirectories as well) by placing a text file called .htaccess in the directory.
Your .htaccess file could look as shown below.

If you want to enable SSI also for .htm documents, just add it to the AddHandler line.

Be careful with enabling SSI for document extensions where you will never actually use it. Doing this will force all pages on your site with an .htm extension (or whatever you chose) to be sent into the server for parsing - whether it actually contains SSI commands or not. This extra parsing time may bog the server down and your web hosting company or your administrator may not like it.

In case your site is hosted on a shared machine - consider this: If your web host supports the use of htaccess but does not offer server side includes, then there is maybe a reason (CPU performance, number of servers running on that box). Please check with your web hosting company before enabling SSI through the .htaccess file. At least enable it only there where you really need it.

# sample for a file .htaccess in your www root directory
AddType text/html .shtml
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes




NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: