Pseudo-static example and Apache pseudo-static configuration

Source: Internet
Author: User

Pseudo-static only changes the display of the URL, in fact, the Site page or dynamic page. A pseudo-static page suffix can be html, HTM, or a directory format. So why use pseudo-static?

Two points reason: 1 is SEO optimization, pseudo-static is conducive to search engine collection, can increase the site optimization effect; 2 is the URL looks simple, the site URL to the professional.

We still implement pseudo-static through the. htaccess file. Specific. htaccess settings See the two Apache domain jump methods to simply complete the redirect in the "2. Use. htaccess to do domain Jump".

To ensure that the. htaccess file is available, we implement pseudo-static by adding related content in. htaccess. Here is a pseudo-static example, I also in the configuration of the # part to give you a brief description of several types of pseudo-static role. Apache pseudo-static configuration code is as follows:

Rewriterule ^article/nsort5-1\.html article_cat\.php\?id=20 [nc,qsa,l]
The actual background performed when #当用户访问 http://www.sodone.com/Article/nsort5-1.html is http://www.sodone.com/article_cat\.php\?id=20
Rewriterule ^article/nsort1-1\.html article_cat\.php\?id=16 [nc,qsa,l]
Rewriterule ^article/nsort2-1\.html article_cat\.php\?id=17 [nc,qsa,l]
Rewriterule ^article/nsort3-1\.html article_cat\.php\?id=18 [nc,qsa,l]
Rewriterule ^article/nsort4-1\.html article_cat\.php\?id=19 [nc,qsa,l]

Rewriterule ^article/article-([0-9]+) \.html$ article\.php\?id=$1 [nc,qsa,l]
The actual background performed when #当用户访问 http://www.sodone.com/Article/ARTICLE-101.html is http://www.sodone.com/article.php?id=101

rewriterule ^help/help ([0-9]+) \.html$ help\.php\?categorie_id=$1 [nc,qsa,l]
rewriterule ^help/help ([0-9]+)-([0-9]+] \.html$ help\.php\?id=$2& categorie_id=$1 [nc,qsa,l]
#当用户访问 http://www.sodone.com/help/ help15-52.html actual background execution is http://www.sodone.com/help.php?id=52&categorie_id=15
#注意 a lot of people here have problems with the $ $ relationship; Replace the URL substitution process for the previous part with $ $, and then replace the $

# Direct One-word Access
Rewriterule ^index\.html$ index\.php [L]
the actual background performed when #当用户访问 http://www.sodone.com/index.html is http://www.sodone.com/index.html
Rewriterule ^category$ index\.php [L]
The actual background performed when #当用户访问 http://www.sodone.com/category is http://www.sodone.com/index.html

Add a few additional notes to the configuration:
L indicates that the current rule is the last rule, and the stop analysis later overrides
NC is case insensitive
QSA the Append request string
^ indicates start of statement
$ indicates the end of the statement

Author: sodone
Copyright belongs to: sodone Crisp egg

Pseudo-static example and Apache pseudo-static configuration

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.