WWW FAQ: How can I "include" one HTML document in another?

How can I "include" one HTML document in another?

Often HTML authors have a copyright notice, logo or other piece of HTML which needs to be included on many different pages. Doing this by hand is, obviously, painful.

One might think there would be an <HTML SRC=""> tag, much like <IMG SRC>, to include one document in another. But this has several problems, one of which is that it would require opening a second connection to the server. This is very inefficient (translation: SLOW for your readers).

"So what can I do about it?"

The most common solution is the "server-side include" mechanism. The NCSA web server, among others, can be configured to recognize documents ending in ".shtml" instead of ".html" as documents that it should scan for server-side include commands referencing other documents or scripts. This is much more efficient because the server, which presumably has direct access to the files involved, does all the work. For details, see the NCSA server documentation <URL:http://hoohoo.ncsa.uiuc.edu/>. Also see the documentation of the WebCom server <URL:http://www.webcom.com/~webcom/help/inc/include.shtml>, which is particularly clear on this topic. Most servers do handle server side includes in a manner consistent with these two.

World Wide Web FAQ