Setting up SSI on WAMP Server

September 9, 2016 Jeff Singleton 0

Server Side Includes (SSI) – Definition The Server Side Includes is a simple interpreted server side scripting used in HTML pages to make it more responsive web pages on web server. It is used in big websites which most parts are repetitive. SSI enables the HTML pages to add one or more files into a web page and come out with given directives. The SSI makes easy to maintain the site. For instance: If any website has numerous HTML pages with dynamic contents and each time only contents need to be change, the SSI works here. It has some commonly used code that can be reused myriad time in a website. When a SSI file is parsed in the server, the server takes the entire content of the file and inserts it into the page, replacing the include code. In other word, you can say that SSI are directive that lets you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or other dynamic technology. How it works: The SSI works as cut and paste editor for HTML pages. When it is used, the server reads the document and parses it for directives. After that it follows the given instructions and finished with manipulation and come onto the browser. The SSI-enable HTML files have special extensions but by default it is shtml, shtm, or shtm. The HTTP server only recognize those documents with containing appropriate extensions. SSI files support only ASP, shtml, PHP extension and can be included only in them. Similar, all the web servers do not support SSI, except few including Apache web server. To apply SSI code in SSI supportive web page, you just need to add the following code:

This code will work for all pages and they will display the latest daily quote. For example: SHTML or ASP:

PHP:

The above code will work as a SSI enable web page and return with the given direction on the browser. Configuring Your Server to permit SSI Permitting SSI on your server, there is a need to have mod_include installed and enabled. Give the following direction in your httpd.conf file, or in a htaccess file:

This command informs Apache that it must ask permission to be parsed for SSI directives. Here, you will have to keep in mind that you will have to give the clear instruction to Apache to parse any specific file. There are two ways to do this: Instruct the Apache to parse any file with a particular file extension, such as. shtml, with the following directives:

However, there is one disadvantage to this approach, if you want to add SSI directives to an existing page, you will have to change the name of that page, and all links to that page, to facilitate .shtml extension, so that those directives can be executed. The second method is to use the XBitHack directive:

XBitHack instruct Apache to parse only those files that contain execute bit set files for SSI directives. So, to add SSI directives to an existing page without changing the name of the file, use the following command.

This will change the mode of any executable file. By default, Apache does not recognize the last modified plans so it fails to send those. To remove this problem, we can use the XBitHack directive that will tell the Apache to recognize the file from the date of origin rather than the last modification. How to add SSI (Server side include support in WAMP)? Open httpd-dot-conf file from C:\WAMPserver\apache2\conf Then add the following code:

The above code should be above “” in httpd-dot-conf file Then find “Options Indexes FollowSymLinks” and replace it with:

Restart your WAMP server and enjoy the joys of server side includes.

1 2 3 6