commit
de45adaadc
@ -0,0 +1,9 @@ |
|||||||
|
location / { |
||||||
|
root /usr/share/nginx/html; |
||||||
|
if ( -f $request_filename ){ |
||||||
|
return 301 http://www.baidu.com; |
||||||
|
} |
||||||
|
if ( -d $request_filename ){ |
||||||
|
return 301 http://www.jd.com; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
#http://alice.testpm.com ==> http://www.testpm.com/alice |
||||||
|
#http://jack.testpm.com ==> http://www.testpm.com/jack |
||||||
|
|
||||||
|
location / { |
||||||
|
if ( $host ~ www.testpm.com ){ |
||||||
|
break; |
||||||
|
} |
||||||
|
if ( $host ~ ^(.*)\.testpm.com$){ |
||||||
|
set $user $1; |
||||||
|
rewrite .* http://www.testpm.com/$user permanent; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
location /alice { |
||||||
|
root /usr/share/nginx/html; |
||||||
|
index a.html; |
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
location / { |
||||||
|
if ( $request_uri ~* abc ){ |
||||||
|
return 402; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
# http://www.testpm.com/a/1.html ==> http://www.testpm.com/b/2.html |
||||||
|
location /a/1.html { |
||||||
|
# http://ip/a/1.html => http://ip/b/2.html |
||||||
|
rewrite .* /b/2.html last; # 如果后面的路径没有加http开头,则表示本站的路径, flag 没有写默认是last |
||||||
|
} |
||||||
|
|
||||||
|
location /b { |
||||||
|
root /usr/share/nginx/html; |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
# http://www.testpm.com/2019/a/1.html ==> http://www.testpm.com/2018/a/1.html |
||||||
|
location /2019 { |
||||||
|
rewrite ^/[0-9]+(/.*)$ /2018$1 permanent; |
||||||
|
} |
||||||
|
|
||||||
|
location /2018 { |
||||||
|
root /usr/share/nginx/html; |
||||||
|
} |
@ -0,0 +1,4 @@ |
|||||||
|
# http://www.qf.com/a/1.html ==> http://jd.com |
||||||
|
location /a/1.html { |
||||||
|
rewrite .* https://www.jd.com; |
||||||
|
} |
@ -0,0 +1,4 @@ |
|||||||
|
# http://www.qf.com/a/1.html ==> http://jd.com/a/1.html |
||||||
|
location / { |
||||||
|
rewrite .* http://www.baidu.com$request_uri permanent; |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
# http://www.tianyun.com/a/b/c |
||||||
|
# $1: /a/b |
||||||
|
# $2: c |
||||||
|
# http://$host$1$2$3/ |
||||||
|
|
||||||
|
location /a/b/c { |
||||||
|
root /usr/share/nginx/html; |
||||||
|
if ( -d $request_filename ) { |
||||||
|
rewrite ^(.*)([^/])$ $1$2/ permanent; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
# 伪静态化 |
||||||
|
# http://www.tianyun.com/login/tianyun.html ==> http://www.tianyun.com/reg/login.html?user=tianyun |
||||||
|
|
||||||
|
location /login { |
||||||
|
rewrite /(.*)/(.*)\.html$ /reg/$1.html?user=$2 permanent; |
||||||
|
} |
||||||
|
|
||||||
|
location /reg { |
||||||
|
root /usr/share/nginx/html; |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
#http://www.tianyun.com/qf/11-22-33/1.html ==> http://www.tianyun.com/qf/11/22/33/1.html |
||||||
|
#http://ip/2019-10-23/hello.html ==> http://ip/2019/10/23/hello.html |
||||||
|
|
||||||
|
# /qf/11-22 |
||||||
|
location ~ qf/[0-9]+- { |
||||||
|
rewrite /qf/([0-9]+)-([0-9]+)-([0-9]+)/(.*)$ /qf/$1/$2/$3/$4 permanent; |
||||||
|
} |
||||||
|
|
||||||
|
# /qf/11/22 |
||||||
|
location ~ ^/qf/[0-9]+/.*$ { |
||||||
|
root /usr/share/nginx/html; |
||||||
|
} |
Loading…
Reference in new issue