Apache rewrite rule writing

Source: Internet
Author: User
Apache rewrite rule writing
1) R [= Code] (Force redirect) force external redirection
Add the replacement string forcibly
Http: // thishost [: thisport]/ The URL with a prefix redirected to an external URL. If the code is not specified, the default 302 HTTP status code will be used.
2) f (Force URL to be forbidden) disables the URL and returns a 403http status code.
3) g (Force URL to be gone) forces the URL to be gone and returns the response HTTP status code.
4) P (Force proxy) enforces proxy forwarding.
5) L (last rule) indicates that the current rule is the last rule. After the analysis is stopped, the rule is overwritten.
6) n (next round) re-runs the rewrite process from the first rule.
7) C (chained with next rule) is associated with the next rule
If the rule matches, it is processed normally and the flag is invalid. If the rule does not match, all associated rules are skipped.
8) t = mime-type (Force MIME type) force MIME type
9) NS (used only if no internal sub-Request) is used only for non-Internal subrequests
10) NC (no case) is case insensitive
11) QSA (query string append) append request string
12) NE (no URI escaping of output) does not escape special characters
Example: rewriterule/Foo/(. *)/bar? Arg = p1/% 3d $1 [R, ne] will be able to correctly convert/Foo/zoo to/bar? Arg = p1 = Zed
13) pass through to next handler to the next Processing
For example:
Rewriterule ^/ABC (. *)/DEF $1 [pt] # will be handed over to/DEF rules for processing
Alias/DEF/Ghi
14) S = num (skip next rule (s) skipping num rules
15) E = var: Val (set environment variable) set Environment Variables

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.