标签:write justify ted user was cep 永久 location ...
redirect标志跟permanent标志的区别是:redirect使用HTTP 302临时重定向,permanent使用HTTP 301永久重定向。本文介绍redirect标志的临时重定向动作。
Nginx配置:
location ~ ^/app2/ {
rewrite ^/app2/(.*)$ /app/$1 redirect;
}
运行结果:
curl -v http://ng.coe2coe.me:8000/app2/
* Hostname was NOT found in DNS cache
* Trying 192.168.197.101...
* Connected to ng.coe2coe.me (192.168.197.101) port 8000 (#0)
> GET /app2/ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: ng.coe2coe.me:8000
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
* Server nginx/1.11.8 is not blacklisted
< Server: nginx/1.11.8
< Date: Sun, 09 Jul 2017 10:27:48 GMT
< Content-Type: text/html
< Content-Length: 161
< Location: http://ng.coe2coe.me:8000/app/
< Connection: keep-alive
<
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx/1.11.8</center>
</body>
</html>
* Connection #0 to host ng.coe2coe.me left intact
Nginx学习笔记15rewrite之(二)redirect临时重定向
标签:write justify ted user was cep 永久 location ...
原文地址:http://www.cnblogs.com/coe2coe/p/7143650.html