HTML static page

Source: Internet
Author: User

Pseudo-Static

Pseudo-Static

Pseudo-Static page, its purpose is to better be indexed by the search engine through a certain rules, the dynamic page address into an htm or HTML end of the address, looks static, is still dynamic page.

but now many CMS website program, can be the dynamic page directly generated true Static Is that the page you are visiting is real, and the root static page is the same. This is the advantage of fast access, do not need to frequently read the filter server data, reduce the pressure on the server, but also better to be included in the search engine.

Main deficiencies

1, of course, as the author of an article said: "If the traffic slightly larger use pseudo-static on the cup use overload, I at the same time online more than 300 people hang up, and do not use pseudo-static when the online Super 500 people are not hanging, my IIS (Internet Information Service) number is 1000. "It is true, because pseudo-static is to use regular judgment instead of the real address, respectively, show which page of responsibility is directly specified by the CPU to judge, so the increase in CPU occupancy, is indeed the biggest drawback of pseudo-static."

2, the website endurance low.

In addition, the website can withstand the simultaneous decrease in number of people online. If your site can guarantee 1000 people to visit at the same time, then after the pseudo-static processing, 300 people access is enough to let your site hang.

3, Web page open slowly.

Pseudo-Static page open fast, is simply too funny, pseudo-static still want to read the database, but also an additional one. Rewrite the URL. The process, the other steps will never be less than the dynamic, how fast?

4, a large number of duplicate pages.

After the pseudo-static, the original page can also be accessed, which resulted in a large number of pseudo-static pages and dynamic page duplication, the site is very bad.

5, need the support of the server.

Not all servers support pseudo-static, which virtually adds cost.

Therefore, if the dynamic parameters in the URL is not up to the extent of the search engine included, the dynamic is much better than pseudo-static.

6, resulting in a real static page can not be accessed.

If PHP pseudo-static HTML, then the real static page can not be accessed. (Can be resolved by modifying the server configuration, but why do you have to pay the strength?)

Method Steps

Locate the Apache configuration file httpd.conf (file in the conf directory), You must first let the server support mod_rewrite.

mod_rewrite :

This module provides a regular expression -based

The parser's rewrite engine to rewrite the URL request in real time. It supports a flexible and powerful URL manipulation mechanism in which each full rule can have an unlimited number of sub-rules and additional conditional rules. This URL operation can depend on a variety of tests, such as server variables, environment variables, HTTP headers, time stamps, and even lookup databases that match the URL component in various formats.

This module can manipulate all parts of the URL, including the path Information section, both at the server level (httpd.conf) and at the directory-level (. htaccess) configuration, and can also generate a final request string. The result of this override operation can be internal sub-processing, or it can be a steering of an external request, or even an internal agent processing.

General Mod_rewrite is not started by default, we need to enable it manually.

Find allowoverride None change to allowoverrideall,

allowoverride :

When you use Apache 's rewrite module to rewrite URLs , the rewrite rules are written in . htaccess file. But to enable Apache to read the contents of the . htaccess file properly, you must have the . htaccess The directory in which you are configuring. From a security consideration, the AllowOverride property of the root directory is generally configured to not allow any Override , i.e.

< Directory/>allowoverride none</directory>

When allowoverride is set to None , the . htaccess file is completely ignored. When this directive is set to All, any directives with the ". htaccess" scope are allowed to appear in the . htaccess file.

For URL rewrite , at a minimum, you need to set the directory to

< Directory/myblogroot/>allowoverride fileinfo</directory>

parameters of the allowoverride

authconfig   Allows the use of instructions related to authentication authorization (authdbmgroupfile, Authdbmuserfile, AuthGroupFile, AuthName, AuthType, AuthUserFile, Require, ET). FileInfo   allows you to use commands that control document types (DefaultType, ErrorDocument, Forcetype, languagepriority, SetHandler, Setinputfilter, Setoutputfilter, Mod_mime add* and remove* directives, etc.), instructions for controlling document metadata (Header, Requestheader, Setenvif, Setenvifnocase, Browsermatch, Cookieexpires, Cookiedomain, Cookiestyle, cookietracking, CookieName), instructions in Mod_rewrite ( Action directives in Rewriteengine, Rewriteoptions, Rewritebase, Rewritecond, Rewriterule) and mod_actions. Indexes   Allow use of commands that control the index of the catalog (adddescription, AddIcon, addiconbyencoding, Addiconbytype, DefaultIcon , DirectoryIndex, fancyindexing, Headername, Indexignore, indexoptions, Readmename, etc.). Limit   allows the use of commands that control host access (Allow, Deny, Order). options[=option,...]   allows you to use commands (options and Xbithack) that control the functionality of the specified directory. You can append a comma-delimited list of options (no spaces) after the equals sign to control which options are allowed for the option directive.

Note : The allowoverride parameter is set to all, which means that URL rule rewriting is supported on the entire server. The Apache server reads the. htaccess file under the directory under each Web site.  Without this file, or if the document does not define any rules about URL rewriting, it will have no effect. For different URLs, you need to add the following in Apache Options followsymlinks allowoverride None

In . htaccess , there are two ways of writing the first, but often the second .

The first type:

Options +followsymlinks

Indexignore * *

Rewriteengine on

# If a directory or a file exists, use it directly

Rewritecond%{request_filename}!-f

Rewritecond%{request_filename}!-d

# Otherwise forward it to index.php

Rewriterule. index.php "L"

Mod_rewrite

FollowSymLinks is required, otherwise 500 internal server error is displayed. Indexignore let the specified file be excluded from the display list, that is, ignore the display, that is, do not display, files can be the full name, or shell-style wildcard characters.  Rewritecond%{request_filename}!-f, this sentence means: If the file exists, directly access the file, do not make the following rewriterule.%{request_filename} request file name!-f is not a file or does not exist!-d is not a directory or does not exist [L] This is the last match and no longer matches down

Rewritecond There's something else, like! -S is a regular file with a length of not 0

If-I is symbolice link

-U use subrequest to check if a URL exists

Wait a minute

Pseudo-static use in Yii

common->config->main.php

First, in the ' Components ' section of the config file config/main.php, add the following settings: ' Urlmanager ' =>array (' enableprettyurl ' + true,//url beautification ' Sho Wscriptname ' + false,//hide index.php ' suffix ' + '. html ',//suffix ' enablestrictparsing ' =>false,//do not require URLs to be strictly matched, you do not need to lose Into the rules ' rules ' = []//url matching rule

)

Rules Instance

' Sitemap\.xml ' = ' site/sitemap ',//Sitemap

' sitemap\.xsl ' = ' site/sitemapxsl ',//Site Index

' page/' = ' page/index ',//single page

'//cat_/page_ ' = '/',//pagination

'//page_ ' = '/',//pagination

'//cat_ ' = '/',//Content List

' tag/index/' = ' tag/index ',//Tag Search page

'/' = '/view ',

'/' = '/',

'/' = '/',

HTML static page

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.