首页 > 代码库 > PHP 框架Phalcon 问题记录

PHP 框架Phalcon 问题记录

1.问题:用官方的例子,首页可以正常打开,但比如说 /signup,contact/index 这样的连接都是出现404 file not find,这样的错误。以上问题在Apache web server是好的。

解决方法:URL重写导致。直接访问 localhost/index.php?_url=/控制器名/方法名. 如:  /index.php?_url=/signup

 

 

Nginx rewrite:

try_files $uri $uri/ @rewrite;
 
        location @rewrite {
            rewrite ^/(.*)$ /index.php?_url=/$1;
        }
去掉index.php:
if ($request_filename !~ (js|css|images|robots/.txt|index/.php.*) ) {
            rewrite ^/(.*)$ /index.php/$1 last;
            break;
        }

PHP 框架Phalcon 问题记录