SSI Learning (2)

Source: Internet
Author: User
1. ssi command # config: Specify the format of the error message, date, and file size returned to the client browser.
# Echo: insert the environment variable value in the HTML page.
# Exec: run an application or a shell command and insert the output to the HTML page.
# Flastmod: insert the file modification date to the HTML page.
# Fsize: insert the file size to the HTML page.
# Include: contains files on HTML or ASP pages.
Because files containing SSI commands need special processing, an SSI file extension must be provided to the SSI File.
The default extension is. stm,. shtm, And. shtml. However, some SSI commands can be used in other files.
2. Enable SSI for Apache Load SSI ModuleSSI uses the dynamic system object of mod_include. It is usually installed by default. in Linux, you can use apachectl-L to check whether the mod_include.o file is included. If not, you need to recompile Apache. For Apache of Win32 version, check whether the loadmodule include_module modules/mod_include.so line in httpd. conf is commented out. If yes, remove #
Configure httpd. conf Enable SSI for files with the .shtml ExtensionRemove the annotations for the following configurations
#AddType text/html .shtml#AddOutputFilter INCLUDES .shtml
Enable include FunctionFind the configuration under the document_root directory of the host.
Options indexes followsymlinks
To:
Options indexes followsymlinks includes
3. Create two pages in the DocumentRoot folder in the demo test:
Index.shtml
Time:   <!--#echo var="DATE_LOCAL" -->   <br>ServerName: <!--#echo var="SERVER_NAME" var="DOCUMENT_URI" --><br>ENV:<!--#printenv --><br><!--#set var="cond" value="true" --><!--#echo var="cond" --><br><!--#if expr="cond='true'" -->    condition is true<!--#else -->    condition is false<!--#endif --><br><!--#include virtual="header.html" -->

Header.html
The head page is included.

Access http: // localhost: 9999/index.shtml in a browser to view the result.





SSI Learning (2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.