1. What is SSI
Server Side Include: Server Side Include is a server-based web page production technology similar to ASP. You can use Server-Side Include (SSI) directives to include text, graphics, or application information into a web page before the content is sent to the browser. For example, you can use SSI to include a time/date stamp, a copyright notice, or a form for customers to fill out and return. Using include files is an easy way to include text or graphics that appear repeatedly in multiple files. Instead of typing content into all files, just put the content into one include file. An include file is called with a very simple statement, which instructs the web server to insert the content into the appropriate web page. And, when you use include files, all changes to the content only need to be done in one place.
2. What are the commands of SSI
[1] Display server-side environment variables
[2] Insert text content directly into the document
[3] Display WEB document related information (such as file creation date/size, etc.)
[4] Directly execute various programs on the server (such as CGI or other executable programs)
[5] Set SSI information display format ; (such as file creation date/size display method) Advanced SSI
3. APACHE configuration SSI
Apache does not support SSI by default and we need to change httpd.conf to configure it. Here I take Apache 2.0.x on the windows platform as an example: open the httpd.conf file in the conf directory and modify the place
[1] Take out the previous comment
LoadModule include_module modules/mod_include.so
[2] Modify Directory
will
<Directory /> Options FollowSymLinks AllowOverride None </Directory>
<Directory /> Options Indexes FollowSymLinks Includes AllowOverride None </Directory>
will
#AddType text/html .shtml #AddOutputFilter INCLUDES .shtml
AddType text/html .shtml .html AddOutputFilter INCLUDES .shtml .html
<!DOCTYPE html> <html> <head> <title>测试SSI</title> </head> <body > <div> <!-- 登陆前显示登录界面,登陆后显示用户名等基本信息 --> <!--#include file="index.php" --> </div> </body> </html>