IS sets pseudo-static method (IIS Rewrite component)

Source: Internet
Author: User
Tags ini php tutorial

Note:Introduction to iis rewrite: a powerful url processing engine with similar functions as mod_rewrite of apache. This is a list. asp tutorial for iis? The link id = 234 is mapped to list/234.html, which facilitates ranking in gg.

The biggest difference between full and lite is that each site can customize the url rewriting rule (rewrite rule), that is, as long as the httpd is written. you can use ini in the root directory of the site.

Installation Instructions: after downloading, you can decompress isapi_rewrite.dll and httpd. ini files are placed under a folder, and then isapi_rewrite.dll can be loaded in the isapi of the iis Site attribute, httpd. ini is an example in the configuration file. If the load fails, set the isapi_rewrite.dll security attribute to complete.



2. In "iis Manager", right-click the website and choose Properties.

 

3. Select "isapi" and click "add ".



4. Enter the filter name, for example, "rewrite ".

 

5. Click "browse" at the bottom of the executable file, and select the location of the extracted rewrite component, rewrite. dll.

 
6. Confirm the selection and click "OK ".

7. Click "OK" to add the filter.

8. Restart iis.

 

9. After iis is restarted, right-click the site and choose Properties. The green arrow shown below indicates that iis rewrite is successfully added and run.

 

Iis rewrite rule settings

In the decompressed iis rewrite component directory (such as c: rewrite), there is an httpd. ini file that writes the corresponding rules to this file.

1. Install the rewrite plug-in rewrite. dll

If your iis server has loaded rewrite. dll, you do not need to download it.

Rewrite. dll file: Baidu search keyword: rewrite. dll download

Load rewrite. dll

Add filter on iis isapi

Filter name: re

Select rewrite. dll for the executable file!

2. Configure httpd. ini
Open your httpd. ini and find

[Isapi_rewrite]

#3600 = 1 hour
Cacheclockrate 3600

Repeatlimit 32

# Protect httpd. ini and httpd. parse. errors files
# From accessing through http
Rewriterule ^ (. *)/archiver/([a-z0-9-]+.html) $1/archiver/index. php tutorial? $2
Rewriterule ^ (. *)/forum-(%0-9%%*-(%0-9%%%%%%%.html $1/forumdisplay. php? Fid = $2 & page = $3
Rewriterule ^ (. *)/thread-(0-9000000000000-(0-9000000000000-(0-90000000000000000.html $1/viewthread. php? Tid = $2 & extra = page % 3d $4 & page = $3
Rewriterule ^ (. *)/profile-(username | uid)-(. + ?). Html $1/viewpro. php? $2 = $3

The above is discuz! The configuration code officially provided. Pay attention to the regular format.

3. Application
For example, read. php? Bl_id = 123 & bu_id = 456 pseudo-static/html/123/456 .html

You can write as follows:

Rewriterule ^ (. *)/html/([0-9] +)/(%0-9%%%%%%.html $1/read. php? Bl_id = $2 & bu_id = $3

To enable your iis server to support pseudo-static rewriting, follow these steps:

1. Install the rewrite plug-in rewrite. dll

If your iis server has loaded rewrite. dll, you do not need to download it.

Load rewrite. dll

Add filter on iis isapi

Filter name: re

Select rewrite. dll for the executable file!

2. Configure httpd. ini
Open your httpd. ini and find

[Isapi_rewrite]

#3600 = 1 hour
Cacheclockrate 3600

Repeatlimit 32

# Protect httpd. ini and httpd. parse. errors files
# From accessing through http
Rewriterule ^ (. *)/archiver/([a-z0-9-]+.html) $1/archiver/index. php? $2
Rewriterule ^ (. *)/forum-(%0-9%%*-(%0-9%%%%%%%.html $1/forumdisplay. php? Fid = $2 & page = $3
Rewriterule ^ (. *)/thread-(0-9000000000000-(0-9000000000000-(0-90000000000000000.html $1/viewthread. php? Tid = $2 & extra = page % 3d $4 & page = $3
Rewriterule ^ (. *)/profile-(username | uid)-(. + ?). Html $1/viewpro. php? $2 = $3

The above is discuz! The configuration code officially provided. Pay attention to the regular format.

3. Application
For example, read. php? Bl_id = 123 & bu_id = 456 pseudo-static/html/123/456 .html

You can write as follows:

Rewriterule ^ (. *)/html/([0-9] +)/(%0-9%%%%%%.html $1/read. php? Bl_id = $2 & bu_id = $3

Another example:

123. php? Id = 123
123, id, 123
Rewriterule ^ 123/id/([0-9] [0-9] [0-9])/$/123.php? Id = $1
Or
Rewriterule ^ 123/id/([0-9] +) $/123.php? Id = $1

Pw rules: [isapi_rewrite]
Rewriterule ^ (. *)-htm-(. *) $ 1.php? $2
Rewriterule ^ (. *)/simple/([a-z0-9_]+.html) $1/simple/index. php? $2

Note: for example, the pseudo-static settings in interactive encyclopedia are similar to those in the setting method. The pseudo-static settings in other systems are similar, the possible difference is that the pseudo-static rule settings are different.

Personal remarks:

$1, $2, and $3 are the matching values of the previous expression.

For example:

^ (. *)/Simple/([a-z0-9_]+.html) $1/simple/index. php? $2

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.