Using SSI for your Website
I just struggled for a few hours yesterday trying to get some JavaScript working on my 98 web pages, and making changes to all those pages can be a real pain! I really should have look into this when I started writing my web page…
After posting questions in forums, I came across SSI (Server Side Includes). One of the benefit of SSI is that it allows you to include other HTML files in your webpages. For example, I have a website with 100 pages, and each of them are using the same header and footer, the same navigation bar, the same newsletter form, the same statistic code, I can create five new files: header.html, footer.html, navigationbar.html, newsletter.html, and stats.html. These files just contain the fragments of html code or javascript. Then, I just add these files in the correct places in my web pages.
This have saves me time from:
1) Cut and paste all that HTML or javascript code into every single of my web pages
2) Making changes to my header or footer. If all of the pages on my site have a similar header, I can include a single file containing the header into my web pages. When the header needs updating, I only update the one page, which is included in all of the pages that use the header.
To use SSI, I need to enable it on my H4P server by adding the folowing directive in my .htaccess file which can be found in my H4P main directory:
AddType text/html .shtml
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes
(The third line is useful if you only want SSI to be enabled on part of your site.)
Next, adding the file, header.html that I have created earlier and include the folowing directive in the correct places in each of my web pages:
If you want to know more of the technical details about how to enable SSI and how to use it see the Apache SSI Tutorial
One good thing to note is that using SSI won’t affect your search engine rank, because the search engine spiders will see the full html source after everything has been included. In fact you can’t even tell that SSI includes have been used if you go to my website http://www.ebusiness-insights.com and do View->Source, despite the fact that I have SSI includes for my header, footer, newsletter and Statistics.
SSI includes can even help your search engine rankings. For example you can use includes to display fresh content on all your pages and change this regularly to give the search engine robots new food to chomp on.
Popularity: 5% [?]
Find out what I am doing right now by following me on Twitter! If you like this post then please consider subscribing to my full feed RSS. You can also subscribe by Email and have new posts sent directly to your inbox.
Here's A Few More Related Posts
No comments yet.