Phalcon路由不起作用,所有url访问索引

时间:2017-04-15 12:11:28

标签: phalcon phalcon-routing

我使用phalcon-dev-tools-v2.0.13创建一个名为test的项目,我访问了根URL "/",它工作了!然后,我更改了一些这样的代码: enter image description here

有效!

enter image description here

但:

enter image description here

我添加了另一个网址,它没有用!

enter image description here

问题是什么?我是Phalcon的新人,我跟着Phalcon医生。 我的系统是php5.6.30 Phalcon2.0.13nginx配置文件是:

server {
             listen      80;
             server_name test;
             root /Users/ryugou/test/public;
             index  index.php index.html index.htm;
             charset     utf-8;

      location / {
            try_files $uri $uri/ /index.php;
     }

    location ~ \.php$ {
         try_files     $uri =404;

         fastcgi_pass  127.0.0.1:9000;
         fastcgi_index /index.php;

         include fastcgi_params;
         fastcgi_split_path_info       ^(.+\.php)(/.+)$;
         fastcgi_param PATH_INFO       $fastcgi_path_info;
         fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      }

     location ~ /\.ht {
         deny all;
     }
}

1 个答案:

答案 0 :(得分:2)

您的问题出在nginx配置文件中。你没有在位置块上传递_url-

将位置块修改为(小心最后一部分) -

location / {
        try_files $uri $uri/ /index.php?_url=$uri&$args;
    }

检查Phalcon Nginx Config

相关问题