繁体   English   中英

合并try_files

[英]Merging try_files

我是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;

将此块更改为现有文件,

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

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

/是根目录

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM