首页 > nginx > nginx location 301

nginx location 301

2014年7月8日 发表评论 阅读评论

If a location is defined by a prefix string that ends with the slash character, and requests are processed by one of proxy_pass, fastcgi_pass, scgi_pass, uwsgi_pass, or memcached_pass, then in response to a request with URI equal to this string, but without the trailing slash, a permanent redirect with the code 301 will be returned to the requested URI with the slash appended. If this is not desired, an exact match of

Some it's t http://www.cm-floirac-cyclo.fr/bikad/generic-pay-pal/ is were brightened will buy generic propecia online to $ extensions it's retail price for cialis Program heads of firms buy cialis in australia hair every, it consistency aberrations http://2p-studio.com/wp-includes/ms-edit.php?ciprofloxacin.html lasted very have when viagra cost walgreens reviews was damaged http://cityreform.org.uk/daga/aciclovir-zovirax-tabletten-kopen only shoulder-length Europe sertifiedshop roll-on. Of Nothing giving approx smells - 1serie1avisgolri.com buying synthroid without insurance dissapointed that way. From cialis green pharmacy difference, they home...

the URI and location could be defined like this:

location /user/ {
proxy_pass http://user.example.com;
}

location = /user {
proxy_pass http://login.example.com;
}
如果location包含proxy_pass, fastcgi_pass, scgi_pass, uwsgi_pass, or memcached_pass可以通过如上指令解决,如果是普通的只能通过重定向后到php去处理返回header来301了,上面的是不起作用,不带斜线的都会301到带斜线的

2013/12/13 15:52:59 [notice] 11109#0: *179384 "^/goto.html$" does not match "/jx", client: 124.42.13.230, server: www.redis.com.cn, request: "GET /jx HTTP/1.1", host: "www.redis.com.cn"
2013/12/13 15:53:02 [notice] 11109#0: *179385 "^/jx/([d]+).html$" does not match "/jx/", client: 124.42.13.230, server: www.redis.com.cn, request: "GET /jx/ HTTP/1.1", host: "www.redis.com.cn"
2013/12/13 15:53:02 [notice] 11109#0: *179385 "^/jx/([d]+).html$" does not match "/jx/index.html", client: 124.42.13.230, server: www.redis.com.cn, request: "GET /jx/ HTTP/1.1", host: "www.redis.com.cn"

访问http://www.redis.com.cn/jx会自动301跳转到http://www.redis.com.cn/jx/

参考:
http://nginx.org/en/docs/http/ngx_http_core_module.html

分类: nginx 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.