Method One: The following is a detailed set of steps for setting up Apache support shtml
Open includes module run shtml
0, open the PHP Environment installation directory (my D:\wamp\Apache2\conf) in the httpd.conf file (about 408-409 lines):
1, AddType text/html. shtml
Addoutputfilter INCLUDES. shtml
2, (f:/shz for the running file storage place)
DocumentRoot "F:/shz" (about 150 places)
<directory "F:/shz" > (about 178 places)
3, after the options Indexes followsymlinks add +includes
such as: Options Indexes followsymlinks +includes (about 197):
Need to restart Apache);
method Two: How to let Apache support. shtml let Apache support include tags
Open the httpd.conf file in the Conf directory and search for "AddType text/html. shtml", search results:
Modified to:
Copy Code code as follows:
AddType text/html. shtml
Addoutputfilter INCLUDES. shtml
Options Indexes FollowSymLinks includes
Save httpd.conf, and start Apache again.
This completes the setup of the Apache SSI.
<!--#include file= "index.php"-->
Personally feel the benefits of SSI is static in the local dynamic processing more convenient, such as the message in the news
The following is a detailed description of the introduction
Because the batch modification is not very good, we always want to be able to use the footer and the end of the page include in the HTML file. HTML is a client-side parsing format language, which is almost impossible to change since 4.0 (after all, many browsers only parse the 4.0 standard) and so far there is no such concept. While the HTML frame (frame and IFRAME) can be used to include the home page and footer file, the concept of frame and IFrame is different from that of the dynamic page (asp,jsp,php, etc.). Frame and the main page of the IFRAME and the included page is not a page, while the page through the inclusion of the main page and the page is included is still a page, so that the page reload when the impact of no speed, there will not be multiple windows such a problem. Of course, the role of frame and IFrame is quite large, but this is not the same as include in the concept of the page.
In addition to frame and IFRAME, the commonly used method of calling the file with JS. This is very close to the include concept, but can require client JS support, and the modification is not very important, Because the included JS is through document.write to output HTML code, so although to achieve the effect, can be JS after all the implementation of client dynamic effect better, such as the current more popular Ajax. So whether it is frame/iframe or JS is not the same as the include (but Dreamweaver in the library and include very similar, unfortunately only in Dreamweaver), and we sometimes page has a lot of static pages, Content is not dynamic and there is no law to follow, the more difficult to do in the database. such as Sina's news and so on, we can use the shtml way to do these pages.
Then what is shtml?
Using the HTML file name extension for SSI (server Side include), SSI (server Side include), commonly referred to as "servers-side embedding" or "server-side inclusion," is an ASP-like server-based Web-making technology. The default extension is. stm,. shtm and. shtml.
What is SSI?
SSI is the abbreviation of English server Side includes, translated into Chinese is the meaning that server side contains. From a technical standpoint, SSI is a command or pointer that is in an HTML file that can be invoked through a comment line. SSI is powerful, with a simple SSI command that enables content updates throughout the site, dynamic display of time and dates, and the execution of complex functions such as shell and CGI scripts. Site maintenance often encountered a problem is that the structure of the site has been fixed, but in order to update a little content and have to redo a large number of pages. SSI provides a simple, effective way to solve this problem, it will be the basic structure of a Web site in a few simple HTML files (templates), we have to do is to upload text to the server, so that the program to follow the template to automatically generate Web pages, so that the management of large Web sites becomes easier.
How do you enable your Apache server to support SSI?
Apache (How to install Apache under Windows and Linuc see another two articles) by default, SSI is not supported, and we need to change httpd.conf to configure it. Here I take the Windows platform Apache 2.0.x for example (same as under Linux platform), open the httpd.conf file in the Conf directory, search "AddType text/html. shtml" and find:
The following is a reference fragment:
Copy Code code as follows:
# AddType text/html. shtml
# Addoutputfilter INCLUDES. shtml
Remove the # in front of these two lines.
Then search "Options Indexes followsymlinks"
Add "Includes" after the search to the line
The line will change to Options Indexes followsymlinks Includes
Familiarity with the Apache manual may feel easier.
Save httpd.conf, restart Apache
This completes the setup of the Apache SSI.
SSI Command:
1. config command
The config command is primarily used to modify the default settings for SSI. which
ErrMsg: Sets the default error message. In order to return the user-defined error message normally, the errmsg parameter must be placed in front of the other SSI commands in the HTML file, otherwise the client can only display the default error message, not the custom information set by the user.
<!--#config errmsg= "error! Please email webmaster@mydomain.com-->
TIMEFMT: Defines the use format for dates and times. The TIMEFMT parameter must be used before the echo command.
<!--#config timefmt= "%A,%B%d,%Y"-->
<!--#echo var= "last_modified"-->
Display results: Wednesday, April 12, 2000
SIZEFMT: Determines whether the file size is expressed in bytes, kilobytes, or megabytes. If the parameter value is "bytes" in bytes, the abbreviation can be used for kilobytes and megabytes. Similarly, the SIZEFMT parameter must be placed in front of the fsize command before it can be used.
<!--#config sizefmt= "bytes"-->
<!--#fsize file= "index.html"-->
2. Include command
The Include command inserts text or pictures from other documents into the currently parsed document, which is the key to the entire SSI. You can update the entire site in an instant by simply changing one file with the Include command!
The include command has two different parameters:
Virtual: gives a dummy path to a document on the server side. For example:<!--#include virtual= "/includes/header.html"-->
File: Gives the relative path to the current directory, where you cannot use the. /"And you cannot use absolute paths. For example:<!--#include file= "header.html"-->
This requires a header.html file to be included in each directory.