nginx url automatically slash problem

A first comparative illustration Nginx two following phenomena:

uri 1. The last visit with a slash

  http: // localhost / product / >>>> look at the index page of the product, there is returned; there is no option and auto-index catalog (instructions are: autoindex on), the reported 403 errors

uri 2. The last visit with no slash

  http: // localhost / product >>>> find the product file, there is returned; if there is product file folders, will produce 301 jumps, and automatically uri complement to http: // localhost / product /, Jump server_name_in_redirect domain controlled by the command (described below)

Two, server_name_in_redirect  instructions configure

1, server_name_in_redirect on, URL redirect: server_name first domain name in the directory name + + /; for example configuration file server_name www.baidu.com; is http: // http redirect to when localhost / product: / /www.baidu.com/product/ (this is a pit)
2, server_name_in_redirect OFF (default value) URL redirection: the original URL of the domain name + directory name + /.

 

Guess you like

Origin www.cnblogs.com/jedi1995/p/11320357.html