合并try_files

时间:2015-06-03 10:48:01

标签: php nginx

我是nginx的新手

我正在使用php kohana并且所有人都与我合作

    root   /var/www/html;
    index index.php  index.html index.htm;

    location / {
                # don’t check $uri/, send to php for nice error message
                try_files $uri /index.php?$query_string;
    }

但我还需要隐藏我的html扩展名

我不知道如何将try_files $uri.html $uri $uri/ =404;添加到上面存在的try_files中。

======更新=====

解决方案是

try_files $uri $uri.html /index.php?$query_string;

1 个答案:

答案 0 :(得分:1)

将此块更改为现有文件

    location / {
        try_files $uri $uri.html /index.php?$query_string;
    }

位置之后的术语是需要应用规则的目录。

/用于根目录