location /template/ {
rewrite ^/template/abc\.html$ /template/abc.php last;
        }上面这一句可以跳转成功;
但是按下面那样写,页面显示时会布局混乱,就像找不到CSS文件一样location /template/ {
rewrite ^/template/abc/$ /template/abc.php last;
        }
以目录形式跳转要怎样写???上面那样写为什么会出现布局混乱???

解决方案 »

  1.   

    不好意思甚少使用nginx 帮不上什么忙.主要是对重写url也不是很熟就记得是正则... 看看是否有其他同学帮帮你。因为是放假所以很多大神都忙着孩子炕头...
      

  2.   

    把$前面的反/去掉呢?rewrite ^/template/abc$ /template/abc.php last;
      

  3.   

    rewrite ^/template/abc\/$ /template/abc.php last;加个\号转义一下试试
      

  4.   

    CSS是相对路径。rewrite ^/template/abc/$ /template/abc.php last;  后面多了一个/就显示不正常了,如果没有是可以正常显示