Set IIS in pseudo-static mode

Source: Internet
Author: User

First, we need to modify httpd. ini and restart IIS.

Save the following content as httpd. ini:

[Isapi_rewrite]
Cacheclockrate 3600
Repeatlimit 32

# Do not change the above three lines. The following are rule settings.
Rewriterule/([0-9, A-Z] *)/(\ d000000000000.html/$1/3wow.mobi? Infoid = $2 [I]
# File content ends

The format of the rule is described as follows:

I (ignore case) Forcibly specifies character matching regardless of case
Example: rewriterule/code/project/([0-9, A-Z] * ).html/3wow.mobi \? Softpy = $1 [I]

Other parameters
I (ignore case)
This flag affects the rewriterule command and the corresponding rewritecond command regardless of case.

F (Forbidden)
Respond to the client, stop the rewriting process, and send the 403 error. Note that in this case, formatstring is useless and can be set to any non-null string.

L (last rule)
Stop the rewrite process here without applying any rewrite rules. Use this flag to prevent the currently overwritten URI from being overwritten again by the subsequent rules.

N (next iteration)
Force rewritingengine to adjust the rule target and restart the rule from scratch (all modifications will be saved). The number of reboots is limited by the value specified by repeatlimit. If this value exceeds n flag, it will be ignored.

NS (Next iteration of the same rule)
Restart the rule process (for example, force repeated rule application) from the same rule with N, and use the repeatlimit command to specify the maximum number of rules that are repeatedly implemented,

P (Force proxy)
Force the target URI to be a proxy internally and immediately scale up to cope with proxy requirements through ISAPI. Make sure that the proxy string is a valid Uri, including the Protocol host, or else the proxy will return an error.

R (explicit redirect)
Forces the server to send a redirection to the client to immediately respond and provide a new address of the destination URI. The redirection rule is often the final rule.

RP (permanent redirect)
It is almost the same as the [R] flag, but the 301http status code is released instead of the 302http status code.

U (unmangle log)
Uri is recorded when the URI is a source requirement rather than a rewrite Requirement

O (normalize)
Standardize the string before implementation. Standardization includes URL-ENCODING, invalid character re-movement, etc. This tag is useful for URLs and URLS-ENDODED Headers

CL (case lower)
Lowercase

Cu (Case upper)
Uppercase

In addition, the regular expression is used to indicate fuzzy matching. Simple and commonly used:
([A-Z] *) Match lowercase English letters
(\ D +) and ([0-9] *) Match numbers
(. *) Fuzzy match, including letters and numbers and other non-Line Characters

Example:

[Isapi_rewrite]
#3600 = 1 hour
Cacheclockrate 3600
Repeatlimit 32
# Protect httpd. ini and httpd. parse. Errors files
# From Accessing through HTTP rewriterule/3wow _ (\ D +) \. html/3wow \. MoBi \? Npage = $1 [N, I]
# Here is the root directory for parsing the post list

# Directly convert without Parameters
Rewriterule/Index \. html/Index \. asp

# With a numeric Parameter
Rewriterule/index-(\ D +) \. html/Index \. asp \? Anid = $1

# Mixed parameters with letters and numbers
Rewriterule/index-([0-9, A-Z] *) \. html/Index \. asp \? An1 = $1

# With a letter-type parameter
Rewriterule/index _ ([A-Z] *) \. html/Index \. asp \? An = $1

# With a numeric Parameter
Rewriterule/3wow-(\ D +) \. html/products \. asp \? Id = $1

# With a letter-type parameter and two numbers
Rewriterule/class-([A-Z] *)-(\ D +) \. html/class \. asp \? Lx = $1 & anid = $2 & nid = $3

 

 

 

Httpd. ini to implement 301 redirection

The following describes in detail how to use httpd. ini to implement 301 redirection in the Windows + IIS environment. Of course, 302 redirection is also mentioned.
Different isapi_rewrite versions are different. Let's look at them one by one:
Under isapi_rewrite 1. x‍: ISAPI 1.3 does not support 301 permanent redirection. It can only implement 302 temporary redirection, just like my host, which is a pity. You can use the 404 page to implement 301 redirection.
<BLOCKQUOTE> [isapi_rewrite]
Cacheclockrate 3600
Repeatlimit 32
# For isapi_rewrite 1.x
Rewritecond HOST: ^ jsjk114 \. com $
Rewriterule (. *) HTTP \: // www \. jsjk114 \. com $1 [R, I]
# Note that only 302 redirection is implemented here

# For isapi_rewrite 2.x
Rewritecond HOST: ^ jsjk114 \. com $
Rewriterule (. *) HTTP \: // www \. jsjk114 \. com $1 [I, RP]
# For isapi_rewrite 3.x
Rewritecond % {http: Host} ^ jsjk114 \. com $
Rewriterule (. *) HTTP \: // www \. jsjk114 \. com $1 [NC, r = 301]
</BLOCKQUOTE> Note: [I, RP]: I indicates case-insensitive, RP indicates 301 redirection, and all the above are Domain Name Redirection.
Detailed information is acceptable.‍Refer to ISAPI rewrite2 official User Manual

Set IIS in pseudo-static mode

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.