精选圈子榜单优站
编程综合
编程综合
技术
20关注
编程技术记录、分享 ,记录你的编程生活点点滴滴!

Nginx 配置请求后缀 - > 实际请求后缀转换


1、添加后缀:所有/Kira/下的请求,实际请求地址都自动添加.html

举个栗子:http://localhost/Kira/index  -> http://localhost/Kira/index.html

        location ^~ /Kira/ {     
            if (!-f $request_filename){  
                rewrite "^/Kira/(.*)$" /$1.html;
                break;  
           }
        }


2、去除后缀:所有/Lina/下的请求,实际请求地址都自动去除.do

举个栗子:http://localhost/Lina/index.do -> http://localhost/Lina/index

        location ^~ /Lina/ {     
            if (!-f $request_filename){  
                rewrite ^/Lina/(.*).do /$1;  
                break;  
           }
        }

  • 若文章侵犯了您的权益,请联系我们进行处理。

  • 2017-11-09
  • 4146阅读
评论