How to make html support <!--#include virtual="/commons-n/top/top-1.html" -->

1, load the ssi module.

Because ssi is a module service item in apache, to use the ssi function, we must first load the ssi module and open the apache configuration file httpd.conf. Find the LoadModule ssl_module modules/mod_ssl.so command, because the service is not loaded by default, so just cancel the comment # before the command to open

 

2, add the file type you need

The default file name using ssi technology is .shtml, we need to set the .shtml suffix in the configuration file, and set the file type settings that need to be parsed for ssi technology according to our own needs. Also find the <IfModule mime_module> in the httpd.conf file:

修改
AddType text/html .shtml .html .htm
AddOutputFilter INCLUDES .shtml .html .htm

 

3. Modify the directory parameters

Find the <Directory "xxxx"> configuration and modify the Options.

It should be noted that ssi can use the shell to execute commands, so this function is dangerous, it will execute any command contained in the exec tag , if your user has permission to modify the content of your web page, it is recommended to turn off this function . Of course, you can also add the IncludesNOEXEC parameter to turn off the exec function while retaining SSI. This time changed to: Options Indexes FollowSymLinks INCLUDES IncludesNOEXEC

 

4. The method of file inclusion reference:
refer to the file of absolute path: <!--#include file="e:/w2/top.shtml"-->
reference the current virtual directory file: <!--#include virtual=" include/top.html"-->The
path must be written correctly, if the path is incorrect, an error will be reported: [an error occurred while processing this directive]

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327086051&siteId=291194637