A server-side include is code that is added to a webpage file before it is downloaded.
The code that is added could be a date stamp, metadata records, navigation, etc.
Include files are often used to simplify website maintenance, as changing a single include file will ‘update’ every page that references the include.
For example, every page in the Motive Web Design Glossary has the same masthead at the top of the page. The top row of buttons, the ‘Motive Glossary’ title, and the search box are all stored in a single include file. If we were to add a new section to the website, we could simply update the glossary masthead include file and a link to that new section would instantly be added to every page of the glossary.
For server-side includes to work, the server must be instructed to process (parse) a webpage before it is downloaded. To determine if a file should be parsed, the server checks the file extension. For example, the Apache web-server is typically configured to parse files ending in.shtml. Apache can be instructed to parse files with other extensions by using an .htaccess file.
To enable Apache to parse server-side includes the server behaviour can be modified using an .htaccess file.
.htaccess files.htaccess file placed in the root-directory of a website will change server behaviour website-wide (unless over-ridden by an .htaccess file at a lower level of the website structure). .htaccess file..htaccess file can also be used to set security directives, copying a new file over the old could remove password protection..htaccess files..htaccess files contain instructions (directives) that modify the operation (behaviour) of the server, on a directory-by-directory basis..htaccess parsing directive instructs the server to parse all files with the specified file extension(s). This can affect the time it takes for a webpage to download. The delay is typically minimal but will varying depending on the number of simultaneous connections, the speed of the server, etc.To enable Apache to parse server-side includes for files ending in both .htm and .html:
AddType text/x-server-parsed-html .html
AddType text/x-server-parsed-html .htm
.htaccess (dot h-t-access).The process of parsing the parent webpage does not change/update the code contained in the included file. If this code links to webpages or images, the link path should be specified in relation to the location of the parent webpage (and not the location of the include file). If a single include is used at a number of directory-levels, then the path should be specified relative to the site root.
Webpages are often created using server-side scripting languages such as ASP or PHP. As webpages can only be processed once before download, a server-side include must be created using the web-server directive or the appropriate scripting language directive, i.e. a webpage cannot contain both a web-server include directive and a server-side scripting language include directive.
: client-side/server-side, links: absolute, relative, root-relative, MIME-type
.htm or .html.