.htaccess syntax parameter description_PHP tutorial
Friends who have been exposed to .htaccess files may not understand some of the syntax on the opposite side. You will often see a rule followed by some capital letters L NC R QSA or something like that. Do you know what they mean? OK, the following article is a brief explanation of the relevant syntax parameters of the .htaccess file.
chain|C (link next rule)
This tag links the current rule to the next rule. It has the effect that if a rule is matched, its successor rules will continue to be processed, that is, this tag will have no effect; if the rule is not matched, its successor rules will be skipped. For example, when performing an external redirect in a directory-level rule, you may need to remove ".www" (".www" should not appear here).
cookie|CO=NAME:VAL:domain[:lifetime[:path]](set cookie)
Set a cookie on the client side. The name of the cookie is NAME and the value is VAL. domain is the domain of the cookie, such as .apache.org, optional lifetime is the validity period of the cookie (minutes), and optional path is the path of the cookie.
env|E=VAR:VAL (set environment variable)
This tag sets the value of the environment variable VAR to VAL. VAL can contain expandable regular expression backreferences ($N and %N). This tag can be used multiple times to set multiple variables. These variables can be indirectly referenced in many subsequent situations, usually in XSSI () or CGI ($ENV{VAR}), or in subsequent RewriteCond Referenced through %{ENV:VAR} in the CondPattern parameter of the instruction. Use this to remember information stripped from the URL.
forbidden|F (forbidden URL)
Forcibly ban the current URL, that is, immediately feedback an HTTP response code 403 (forbidden). Using this tag, you can chain several RewriteConds to conditionally block certain URLs.
gone|G (forced abandonment of URL)
Forcing the current URL to be obsolete, that is, immediately feedback an HTTP response code 410 (obsolete). Use this tag to indicate that the page has been abandoned and no longer exists.
handler|H=Content-handler (mandatory content handler specification)
Strongly customize the content handler of the target file as Content-handler. For example, the ScriptAlias directive is used to emulate the mod_alias module to force all files within the mapped folder to be processed by the "cgi-script" processor.
last|L (ending rule)
Stop the rewrite operation immediately and no other rewrite rules will be applied. It corresponds to the last command in Perl or the break command in C language. This tag is used to prevent the currently rewritten URL from being rewritten again by subsequent rules. For example, you can use it to rewrite the URL of the root path (/) to an actual URL (for example: /e/www/).
next|N(start over)
Re-execute the rewrite operation (starting over from the first rule). At this time, the URL processed again is no longer the original URL, but the URL processed by the last rewriting rule. It corresponds to the next command in Perl or the continue command in C language. This mark allows the rewrite operation to be restarted (immediately back to the beginning of the loop). But be careful not to create an infinite loop!
nocase|NC(ignore case)
It makes Pattern ignore case, that is, when Pattern matches the current URL, there is no difference between A-Z and a-z.
noescape|NE (Do not escape URIs in output)
This tag prevents mod_rewrite from applying normal URI escaping rules to the rewrite results. Under normal circumstances, special characters (%, $, ;, etc.) will be escaped to the equivalent hexadecimal encoding (%25′, %24′, %3B, etc.). This flag prevents such escaping to allow symbols such as percent signs to appear in the output, such as:
RewriteRule /foo/(.*) /bar?arg=P1%3d$1 [R,NE] can redirect /foo/zed to a safe request /bar?arg=P1=zed
nosubreq|NS (internal subrequests are not processed)
This tag forces the rewrite engine to skip the rewrite rule when the current request is an internal subrequest. For example, when mod_include attempts to search the directory default file (index.xxx), Apache will generate a subrequest internally. Rewriting rules is not necessarily useful for subrequests, and it may even throw an error if the entire ruleset is in effect. Therefore, you can use this tag to exclude certain rules. Usage principle: If you add a CGI script prefix to URLs to force them to be processed by CGI scripts, but the error rate (or resource overhead) of subrequest processing is high, in this case, you can use this tag.
proxy|P (forced to be a proxy)
This flag causes the replacement component to be internally forced to be sent as a proxy request, immediately interrupting rewrite processing and handing over processing to the mod_proxy module. You must ensure that this replacement string is a valid URI that can be processed by mod_proxy (such as starting with http://www.phpernote.com), otherwise you will get an error returned by the proxy module. Using this tag, certain remote components can be mapped to the local server domain name space, thereby enhancing the functionality of the ProxyPass directive. Note: To use this feature, the mod_proxy module must be enabled.
passthrough|PT (hand over to next processor)
This tag forces the rewrite engine to set the uri field in the internal request_rec structure to the value of the filename field. This small modification enables the output of the RewriteRule directive to be converted from URI to filename by Alias, ScriptAlias, Redirect Wait for instructions for post-processing [Original text: This flag is just a hack to enable post-processing of the output of RewriteRule directives, using Alias, ScriptAlias, Redirect, and other directives from various URI-to-filename translators.].
Give an example to illustrate its meaning: If you want to rewrite /abc to /def, and then use mod_alias to convert /def to /ghi, you can do this:
RewriteRule ^/abc(.*) /def$1 [PT]
Alias /def /ghi
If the PT tag is omitted, although the part that rewrites uri=/abc/… to filename=/def/… works fine, subsequent mod_alias will encounter failures when trying to convert the URI to a file name. Note: This tag must be used if you need to mix multiple modules that convert URIs to file names. . Mixing mod_alias and mod_rewrite here is a typical example.
qsappend|QSA(append query string)
This tag forces the rewrite engine to append a query string to the existing replacement string instead of simply replacing it. You can use this tag if you need to add information to the request string through rewriting rules.
redirect|R [=code](force redirect)
If the Substitution starts with http://thishost[:thisport]/ (making the new URL a URI), an external redirect can be forced. If no code is specified, an HTTP response code 302 (Temporary Move) is generated. If you need to use another response code in the range 300-400, just specify it here (or use one of the following symbolic names: temp (default), permanent, seeother). Use it to feed back the normalized URL to the client, such as rewriting "/~" to "/u/", or always adding a slash to /u/user, etc.
Note: When using this tag, you must ensure that the replacement field is a valid URL. Otherwise, it would point to an invalid location! And remember that this tag itself just prefixes the URL with http://thishost[:thisport]/, the rewriting operation will still proceed. Usually, you will also want to stop the rewriting operation and redirect immediately, so you will also need to use the L flag.
skip|S=num (skip subsequent rules)
This tag forces the rewrite engine to skip num rules after the current matching rule. It can simulate an if-then-else structure: the last rule is a then clause, and the skip=N rules are else clauses. Note: It is different from the chain|C tag!
type|T=MIME-type (mandatory MIME type)
Forcing the MIME type of the target file to be MIME-type, which can be used to force the content type based on certain conditions. For example, the following command allows .php files to be displayed by mod_php according to the MIME type of the PHP source code (application/x-httpd-php-source) when called with the .phps extension:
RewriteRule ^(.+.php)s$ $1 [T=application/x-httpd-php-source]
Articles you may be interested in
- phpMyAdmin Cannot start session without errors error solution
- .htaccess How to set up anti-hotlinking for pictures in a directory
- Usage of several keywords such as $this, static, final, const, self, etc. in php
- Use .htaccess ban list directory
- Fatal error Class 'SoapClient' not found in...Error handling method
- php prompts Maximum execution time of 30 seconds exceeded... Solutions to errors
- 10 practical .htaccess code snippets
- Use .htaccess to deny certain IP access to the website

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



New feature of PHP5.4 version: How to use callable type hint parameters to accept callable functions or methods Introduction: PHP5.4 version introduces a very convenient new feature - you can use callable type hint parameters to accept callable functions or methods . This new feature allows functions and methods to directly specify the corresponding callable parameters without additional checks and conversions. In this article, we will introduce the use of callable type hints and provide some code examples,

Product parameters refer to the meaning of product attributes. For example, clothing parameters include brand, material, model, size, style, fabric, applicable group, color, etc.; food parameters include brand, weight, material, health license number, applicable group, color, etc.; home appliance parameters include brand, size, color , place of origin, applicable voltage, signal, interface and power, etc.

i9-12900H is a 14-core processor. The architecture and technology used are all new, and the threads are also very high. The overall work is excellent, and some parameters have been improved. It is particularly comprehensive and can bring users Excellent experience. i9-12900H parameter evaluation review: 1. i9-12900H is a 14-core processor, which adopts the q1 architecture and 24576kb process technology, and has been upgraded to 20 threads. 2. The maximum CPU frequency is 1.80! 5.00ghz, which mainly depends on the workload. 3. Compared with the price, it is very suitable. The price-performance ratio is very good, and it is very suitable for some partners who need normal use. i9-12900H parameter evaluation and performance running scores

C++ parameter type safety checking ensures that functions only accept values of expected types through compile-time checks, run-time checks, and static assertions, preventing unexpected behavior and program crashes: Compile-time type checking: The compiler checks type compatibility. Runtime type checking: Use dynamic_cast to check type compatibility, and throw an exception if there is no match. Static assertion: Assert type conditions at compile time.

Hyperbolic functions are defined using hyperbolas instead of circles and are equivalent to ordinary trigonometric functions. It returns the ratio parameter in the hyperbolic sine function from the supplied angle in radians. But do the opposite, or in other words. If we want to calculate an angle from a hyperbolic sine, we need an inverse hyperbolic trigonometric operation like the hyperbolic inverse sine operation. This course will demonstrate how to use the hyperbolic inverse sine (asinh) function in C++ to calculate angles using the hyperbolic sine value in radians. The hyperbolic arcsine operation follows the following formula -$$\mathrm{sinh^{-1}x\:=\:In(x\:+\:\sqrt{x^2\:+\:1})}, Where\:In\:is\:natural logarithm\:(log_e\:k)

Lambda expression is an anonymous function without a name, and its syntax is: (parameter_list)->expression. They feature anonymity, diversity, currying, and closure. In practical applications, Lambda expressions can be used to define functions concisely, such as the summation function sum_lambda=lambdax,y:x+y, and apply the map() function to the list to perform the summation operation.

Reference parameters in C++ functions (essentially variable aliases, modifying the reference modifies the original variable) and pointer parameters (storing the memory address of the original variable, modifying the variable by dereferencing the pointer) have different usages when passing and modifying variables. Reference parameters are often used to modify original variables (especially large structures) to avoid copy overhead when passed to constructors or assignment operators. Pointer parameters are used to flexibly point to memory locations, implement dynamic data structures, or pass null pointers to represent optional parameters.

We must have used the vlookup function when using excel. So there are several such functions, and how each function is used. As far as the editor knows, there are four vlookup functions, namely Lookup_value, Table_array, col_index_num, and Range_lookup. So let me tell you their specific usage~ The vlookup function has several parameters and the meaning of each parameter. The parameters of the vlookup function include Lookup_value, Table_array, col_index_num, and Range_lookup, a total of 4. 1.Lookup
