Nginx Rewrite
1. Nginx Rewrite basic mark (Flags)
Last-basically use this flag.
※ equivalent to http://www.aliyun.com/zixun/aggregation/14417.html ">apache [L] tag, indicating completion of rewrite, no longer match the following rules
Break-Abort Rewirte, no longer match
Redirect-returns the temporarily redirected HTTP status 302
Permanent-Returns the HTTP status of a permanent redirect 301※ the URL that supports regular overrides does not support regular
2. Regular expression matching, where:
* To match case sensitivity
* ~* matching for case-insensitive
*!~ and!~* are case insensitive and case-insensitive mismatches, respectively
3. File and directory matching, where:
*-F and!-f are used to determine whether a file exists
*-D and!-d used to determine whether a directory exists
*-E and!-e used to determine whether a file or directory exists
*-X and!-x are used to determine whether a file is executable
3. Some of the global variables available in Nginx can be judged by condition:
$args
$content _length
$content _type
$document _root
$document _uri
$host
$http _user_agent
$http _cookie
$limit _rate
$request _body_file
$request _method
$remote _addr
$remote _port
$remote _user
$request _filename
$request _uri
$query _string
$scheme
$server _protocol
$server _addr
$server _name
$server _port
$uri
Nginx Redirect
All ithov.com and netseek.ithov.com domain names from the jump to http://www.ithov.com
Server
{
Listen 80;
server_name ithov.com netseek.ithov.com;
Index index.html index.php;
Root/data/www/wwwroot;
if ($host!~ "^www\.linxtone\.org$") {
Rewrite ^ (. *) http://www.ithov.com$1 redirect;
}
........................
}