Set pseudo-static methods for IIS under Windows Server with IIS rewrite component

Source: Internet
Author: User

1. Unzip the downloaded IIS Rewrite component and place it in the appropriate directory (e.g. C:rewrite), and the IIS Rewrite component downloads http://www.helicontech.com/download-isapi_rewrite.htm, IIS Rewrite Simplified version of the components download http://www.newhua.com/soft/71446.htm, download the decompression after you do not install copy to the eye

2. Unzip the downloaded IIS Rewrite component and place it in the appropriate directory (e.g. C:rewrite), and download the IIS Rewrite component Http://www.helicontech.com/download-isapi_ Rewrite.htm,iis Rewrite simplified version of the components download http://www.newhua.com/soft/71446.htm, download down after decompression without installation copy to the directory settings can be used.

Note: An introduction to the simple use of IIS rewrite: A powerful URL processing engine, similar to the Apache Mod_rewrite, which is a for IIS version that maps links like list.asp?id=234 to list/234.html This will benefit the rankings in GG.

The biggest difference between full and simplified (Lite) is that you can have each site customize the URL rewrite rule (Rewrite rule), that is, you can use the Httpd.ini as long as it is placed in the site root directory.

Installation instructions: After downloading can extract Isapi_rewrite.dll, Httpd.ini these two files into a folder, and then load Isapi_rewrite.dll in the ISAPI of the IIS site properties, Httpd.ini is the configuration There are examples in this piece. If the load is unsuccessful, give the Isapi_rewrite.dll security attribute as complete.

2, in the "IIS Manager" Select the site, right-click, properties.

3. Select "ISAPI" and click "Add".

4, fill in the filter name, such as "rewrite".

5, under the executable file click "Browse", select the Rewrite component location just extracted, Rewrite.dll.

6. After confirming the selection, click "OK".

7. Click "OK" to complete the filter Add.

8. Restart IIS.

9. After restarting IIS, select the site again, right-click, properties, see the Green arrows as shown below, indicating that IIS Rewrite successfully added and ran.

IIS Rewrite Rule settings:

In the extracted IIS Rewrite component directory (such as C:rewrite), there is a Httpd.ini file that writes the appropriate rules to this file.

1. Install the rewrite plugin Rewrite.dll:

If your IIS server has loaded Rewrite.dll, you can not download it.

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

Load Rewrite.dll

To add a filter on an ISAPI on IIS

Filter name is: RE

Executable file Selection Rewrite.dll on the go!

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?2rewriterule (. ∗)/forum− ([0−9]+) − ([0−9]+). Html2rewriterule (. ∗)/forum− ([0−9]+) − ([0−9]+). HTML 1/forumdisplay.php?fid=1/forumdisplay.php?fid=2&page= 3RewriteRule (. ∗)/thread− ([0−9]+) − ([0−9]+) − ([0−9]+). Html3rewriterule (. ∗)/thread− ([0−9]+) − ([0−9]+) − ([0−9]+). html 1/viewthread.php?tid=1/viewthread.php?tid=2&extra=page%3d4&page=4&page=3
Rewriterule ^ (. *)/profile-(USERNAME|UID)-(. +?). Html1/viewpro.php?2=2=3

The above is the official configuration code provided by discuz!, note the regular format.

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

It can be written like this:

Rewriterule ^ (. *)/html/([0-9]+)/([0-9]+). html1/read.php?bl_id=2&bu_id=2&bu_id=3

To enable your IIS server to support pseudo-static overrides, follow these steps:

1. Install the rewrite plugin Rewrite.dll:

If your IIS server has loaded Rewrite.dll, you can not download it.

Load Rewrite.dll

To add a filter on an ISAPI on IIS

Filter name is: RE

Executable file Selection Rewrite.dll on the go!

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?2rewriterule (. ∗)/forum− ([0−9]+) − ([0−9]+). Html2rewriterule (. ∗)/forum− ([0−9]+) − ([0−9]+). HTML 1/forumdisplay.php?fid=1/forumdisplay.php?fid=2&page= 3RewriteRule (. ∗)/thread− ([0−9]+) − ([0−9]+) − ([0−9]+). Html3rewriterule (. ∗)/thread− ([0−9]+) − ([0−9]+) − ([0−9]+). html 1/viewthread.php?tid=1/viewthread.php?tid=2&extra=page%3d4&page=4&page=3
Rewriterule ^ (. *)/profile-(USERNAME|UID)-(. +?). Html1/viewpro.php?2=2=3

4&amp;page= "> "> 2 = ">< Span class= "Mjx_assistive_mathml" >
above is the official configuration code provided by discuz!, note the regular format.

3. Application:
For example, read.php?bl_id=123&bu_id=456 pseudo-static into a/html/123/456.html

It can be written like this:

Rewriterule ^ (. *)/html/([0-9]+)/([0-9]+). html1/read.php?bl_id=2&bu_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=/123.php?id=1
Or
Rewriterule ^123/id/([0-9]+)/123.php?id=/123.php?id=1

PW's rules: [Isapi_rewrite]
Rewriterule ^ (. *)-htm-(. *) 1.php?2rewriterule (. ∗)/simple/([a−z0−9]+.html) 2RewriteRule (. ∗)/simple/([a−z0−9]+.html ) 1/simple/index.php?1/simple/index.php?2

Note: For example, the pseudo-static of the interactive encyclopedia, the Setup method and these are similar, learn this method of some other systems pseudo-static settings are similar, the different may be pseudo-static rule settings will not be the same.

Personal notes:

Here's 1, 2, $ $ is the previous expression's match value

Like what:

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

Set pseudo-static methods for IIS under Windows Server with IIS rewrite component

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.