After restful is configured in yii2, a 404 error is reported under nginx
PHP中文网
PHP中文网 2017-05-16 17:10:04
0
1
663

After the restful configuration in the yii2 framework is completed, you can use
api.test.com/index.php/users to access under apache
However, when accessing like this under nginx, a 404 error is reported

What is not done well?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
phpcn_u1582

Change the access address to: api.test.com/users

'urlManager' => [
    'enablePrettyUrl' => true,
    //'enableStrictParsing' => true,
    'showScriptName' => false,
    'rules' => [
        ['class' => 'yii\rest\UrlRule', 'controller' => 'user'],
    ],
]

The above is to beautify the route, which can be understood as removing 'index.php'

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!