Pseudo-static regular wording

Pseudo-static generated online: http://www.bm8.com.cn/webtool/htaccess/      

  • It was written before the rules, as we talk about the meaning of the first rewrite in design to the special characters. Regular and ordinary are common!
  • * Front represents 0 or more characters
  • + Front represents 1 or more characters
  • ? 0 or a representative of the previous character
  • ^ Represents the beginning of the string
  • $ Position represents the end of the string
  • For wildcard for any character
  • \ With the reduction in the subsequent character is the character itself, for example, "\ +" represents is "+", rather than other means.
  • ^ Represents a non-meaning in square brackets. For example, [^] Representative non-wildcard.

Usually used in:

~ Is case-insensitive matching.
~ * Of the case-insensitive matching (matching firefox regular match both FireFox).
! ~ Do not match
! ~ * Does not match

. Matches any character other than a new line
\ w match or letters or numbers or underscore characters
\ s matches any whitespace
\ d match numbers
\ b matches the beginning or end of a word
^ string matches the start
end of the matching string $

* Repeated zero or more times
+ repeated one or more times
? Repeated ZeroOrOne
{n} repeated n times
{n,} n times or more times
{n, m} is repeated n times to m
*? repeated any number of times, but as few repeat
+? repeated one or more times, but less repeated as
?? 0 or 1 was repeated, but as little as possible repetition
{n, m}? m to repeated n times, but as few repeated
{n,}? repeated n times or more, but less repeated as

\ W matches any instead of letters, numbers, underscores, kanji character
\ S matches any not whitespace characters
\ D matches any non-numeric characters
\ B matches are not words beginning or ending position
[^ x] matches except of x any character

The multi-add two new rules

1: Access wojiuwangla.com/wangla.html jump to Baidu

2: wojiuwangla.com/ pure digital access at least one digital .html jump to QQ official website

3: Access wojiuwangla.com/ matching letters or numbers or underscores combination .html asked to jump to the official website

 

Learned these rules configuration, pseudo-static rules configured nginx basic associates degree, ha ha ha ha ...
Scene One:
http://www.abc.com/index.php/front/index/index
rewritten http: / /www.abc.com/a.html

Scene 2: 1.2 The parameters to parse. 3
1.http: //www.abc.com/index.php/front/index/parse/name/yangxignyi/age/18
2.http: //www.abc. ? COM / index.php / Front / index / the parse name = yangxignyi & Age = 18
3.http: //www.abc.com/parse-yangxignyi-18.html
server configuration file:

server{
listen 80;
server_name www.abc.com;
root "D:/phpStudy/WWW/abc";
location / {
index index.php index.htm /public/index.html;
autoindex off;
include abc.conf;
#rewrite a.html /index.php/front/index/index last;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}

Pseudo-static configuration files can be written directly in the location / {} which is not recommended to do so, the proposed new increase rewrite.conf write a pseudo-static files will be a good point, include came on the line, so you can write n in which more than rewrite.conf configuration

LOCATION / {
index index.php index.htm /public/index.html;
autoindex OFF;
the include rewrite.conf;
#rewrite a.html /index.php/front/index/index Last;

# rewrite.conf (this file yourself created on the line, the document written rules)

# Scene of a rule
#http: //www.abc.com/index.php/front/index/index
rewrite a.html /index.php/front/index/index Last;

# Scene Two rules
# 1.http: //www.abc.com/index.php/front/index/parse/name/yangxignyi/age/18
# 2.http: //www.abc.com/index. PHP / Front / index / yangxignyi the parse name = & Age = 18 is?
# 3.http: //www.abc.com/parse-yangxingyi-18.html
the rewrite the parse - (\ + W) - (\ + D) HTML / index.. php / front / index / parse / name / $ 1 / age / $ 2 last;

who saw regular students know \ w + and \ d + is what is the meaning of it, \ w alphanumeric character underscore mean, \ d is a digit is a least mean + {1, 1} to {1,3} such infinity is 1 to 3 digits, on a regular matter here is not introduced, a regular look know, oh! ! !

The rules are written, remember to restart nginx, in order to eat Oh! ! !

Guess you like

Origin www.cnblogs.com/lingen163/p/10979125.html