DelphiFAQ Home Search:

Enabling SSI (server side includes) on Apache

 

comments25 comments. Current rating: 5 stars (1 votes). Leave comments and/ or rate it.

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

Comments:

You are on page 1 of 2, other pages: [1] 2
2009-09-14, 22:18:42
anonymous from Houston, United States  
rating
2014-06-30, 16:42:33
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:43:40
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:44:55
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:45:59
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:46:56
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:47:47
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:48:45
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:49:36
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:50:43
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:52:32
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:52:32
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:54:50
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:55:46
anonymous from Malaysia  
MELAKA MY
2014-06-30, 16:56:38
anonymous from Malaysia  
MELAKA MY
You are on page 1 of 2, other pages: [1] 2

 

 

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: