nginx rewrite rewrite rule concise notes

nginx rewrite rewrite rule concise notes

 

Let's say http://newmiracle.cn/?p=888
I want to be able to change this access http://newmiracle.cn/p888/

First, with n is acquired 888 ^ p ([0-9] * ) / $
and
<pre>
LOCATION / {
the root / Home / WWW / WordPress;
index the index.php index.html index.htm;
! IF (-e $ request_filename ) {
the rewrite ^ / P ([0-9] *) / $ / $ = P Last. 1;?
#rewrite /index.html / P = 967 the redirect;?
BREAK;
}
}
</ pre>
Note that the front / must to add otherwise error
debugging method can be changed to redirect redirect last jump
1 If you do not jump so there is no match to
2 there is no jump the jump to the correct path

Well, then changed last adjustment

 

 

Guess you like

Origin www.cnblogs.com/newmiracle/p/11875979.html