DelphiFAQ Home Search:
General :: Linux :: Apache
Know-how about Apache, the most popular web server. Both Linux and Windows related information,

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

Enabling SSI (server side includes) on Apache

Question:

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

Answer:

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:
/usr/local/apache/conf/httpd.conf

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

Generated 16:00:40 on Oct 19, 2017