在nginx配置文件.conf中添加:

  • 隐藏.html后缀
 location / {  
     if (!-e $request_filename){ 
           rewrite ^(.*)$ /$1.html last;
           break;
      }   
 }
  • 隐藏.php后缀
 location / {  
     if (!-e $request_filename){ 
           rewrite ^(.*)$ /$1.php last;
           break;
      }   
 }