Skip to content


nginx 目录自动加斜线”/”

 

默认配置当你访问http://abc.example.com/dir 时不会加”/”

常见做法

      if (-d $request_filename){
  rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
      }

更佳的替代方法

optimize_server_names off;#优化服务器名称:关
server_name_in_redirect off;#服务器名称重定向:关

http://wiki.codemongers.com/NginxHttpCoreModule#optimize_server_names

Posted in Nginx, 技术.

Tagged with , .


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.