Rules _php techniques for parsing htaccess pseudo-static

Source: Internet
Author: User

The use of htaccess files can be a good site pseudo static, and the formation of the target address and the real static page almost identical, such as wangqu.html, pseudo static can be very good combination of SEO to improve the ranking of the site, and also can give a stable impression.

Since pseudo-static must be completely different from different sites, we can simply introduce the principle and give some examples of common programs:

To use pseudo static through htaccess, the space quotient must support the rewrite module, which is responsible for rewriting the URL. Otherwise, it is set up, cannot be used, and there may be a 500 error.

The following is the pseudo-static settings text for Discuz:

# Open the Rewriteengine mode
Rewriteengine on
# Rewrite System rules do not modify
Rewriterule ^archiver/((Fid|tid)-[0-9]+\.html) $ archiver/index.php?$1
Rewriterule ^forum-([0-9]+)-([0-9]+) \.html$ forumdisplay.php?fid=$1&page=$2
Rewriterule ^thread-([0-9]+)-([0-9]+)-([0-9]+) \.html$ viewthread.php?tid=$1&extra=page\%3d$3&page=$2
Rewriterule ^space-(Username|uid)-(. +) \.html$ space.php?$1=$2
Rewriterule ^tag-(. +) \.html$ tag.php?name=$1

The following is the pseudo-static settings text for Phpwind:

Rewriteengine on
Rewritebase/
Rewriterule ^ (. *)-htm-(. *) $ $1.php?$2
Rewriterule ^ (. *) simple/([a-z0-9\_]+\.html) $ $1/simple/index.php?$2

In addition, there are a number of different rules, if you want to work out the pseudo static rules for your site, you must be familiar with the site structure and regular expressions.

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.