File Types (33)
Internet Explorer (6)
Enabling SSI (server side includes) on Apache
26 comments. Current rating: (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:
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.