In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
In this article, the editor introduces in detail "how to use SSI on apache SHTML pages" with detailed content, clear steps and proper handling of details. I hope that this article "how to use SSI on apache SHTML pages" can help you solve your doubts.
Method 1: here are the detailed steps for setting apache to support shtml
Open the includes module and run shtml
0. Open the httpd.conf file in the installation directory of the php environment (mine is d:\ wamp\ apache2\ conf):
1 、 addtype text/html .shtml
Addoutputfilter includes .shtml
2. (f:/shz is the place where the running files are stored)
Documentroot "f:/shz" (about 150)
(about 178)
3. Add + includes after options indexes followsymlinks
Such as: options indexes followsymlinks + includes (about 197places):
Need to restart apache)
Method 2: how to make apache support .shtml and let apache support include tags
Open the httpd.conf file in the conf directory and search for "addtype text/html .shtml". The results are as follows:
Modified to:
The copy code is as follows:
Addtype text/html .shtml
Addoutputfilter includes .shtml
Options indexes followsymlinks includes
Save httpd.conf and restart apache.
At this point, we have finished setting up apache ssi.
Personally, I think the advantage of ssi is that it is more convenient to deal with local dynamics in static, such as messages in the news.
The following is a detailed description
Because batch modification is very bad, we always want to include the footer and footer into the html file. Html is a client-side parsing formatting language, and it's hard to change much since 4.0 (after all, many browsers only parse according to the 4.0 standard), so there is no such concept as include. Although the frames of html (frame and iframe) can be used to contain the home page and footer files, the concept of frame and iframe is different from the include of dynamic pages (asp,jsp,php, etc.). The main page of frame and iframe is not the same page as the included page, while the main page called by include is still the same page as the included page, so that the page is not affected by speed when the page is reloaded. And there won't be the problem of multiple windows. Of course, frame and iframe still play a big role, but this is different from the concept of include, which includes pages.
In addition to frame and iframe, the common way to call a file is using js. This is very close to the concept of include, but you can need the support of client-side js, and the modification is not very good, because the included js outputs html code through [xss_clean]. Although this can achieve results, js executes client-side dynamic effects better after all, such as ajax, which is now more popular. So both frame/iframe and js are different from include (but library in dreamweaver is very similar to include, but it's a pity that it can only be used in dreamweaver), while we sometimes have a lot of static pages, the content is not dynamic and there are no rules to follow, let alone go to the database. Such as Sina news and so on, at this time we can use shtml to do these pages.
So what is shtml?
Using the html file extension of ssi (server side include), ssi (server side include), commonly referred to as "server-side embedding" or "server-side inclusion", is a server-based web page creation technology similar to asp. The default extensions are .stm, .shtm, and .shtml.
What is ssi?
Ssi is the abbreviation of English server side includes, which translates into Chinese is the meaning contained on the server side. Technically, a ssi is a command or pointer that can be called through a comment line in an html file. Ssi has a powerful function, as long as a simple ssi command can be used to achieve the entire site content update, time and date dynamic display, as well as the execution of shell and cgi scripts and other complex functions. One of the problems often encountered in website maintenance is that the structure of the website is fixed, but a large number of pages have to be redone in order to update a little content. Ssi provides a simple and effective way to solve this problem. It puts the basic structure of a website into several simple html files (templates). In the future, all we have to do is to transfer the text to the server and let the program automatically generate web pages according to the template, thus making it easy to manage large websites.
How to make your apache server support ssi?
Apache (see the other two articles on how to install apache under windows and linuc) does not support ssi by default, so we need to change httpd.conf to configure it. I will take apache 2.0.x of the windows platform as an example (the same as on the linux platform). Open the httpd.conf file in the conf directory, search for "addtype text/html .shtml" and find:
The following is a reference clip:
The copy code is as follows:
# addtype text/html .shtml
# addoutputfilter includes .shtml
Remove the # in front of these two lines.
Then search for "options indexes followsymlinks"
Add "includes" after the line found
Change the line to options indexes followsymlinks includes
Those who are familiar with apache manual may find it easier.
Save httpd.conf and restart apache
At this point, we have finished setting up apache ssi.
Ssi command:
1. Config command
The config command is mainly used to modify the default settings of ssi. Where:
Errmsg: sets the default error message. In order to return the error message set by the user normally, the errmsg parameter must be placed in front of 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.
Timefmt: defines the format for the use of dates and times. The timefmt parameter must be used before the echo command.
The display result is: wednesday, april 12, 2000
Sizefmt: determines whether the file size is expressed in bytes, kilobytes, or megabytes. If it is in bytes, the parameter value is "bytes"; for kilobytes and megabytes, you can use abbreviations. Similarly, the sizefmt parameter must precede the fsize command before it can be used.
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. Through the include command, you only need to change one file to update the entire site instantly!
The include command has two different parameters:
Virtual: gives a virtual path to a document on the server side. For example:
File: give a relative path to the current directory, where you cannot use ".. /" or an absolute path. For example:
This requires that each directory contain a header.html file.
After reading this, the article "how to use SSI on apache SHTML web pages" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.