search

Home  >  Q&A  >  body text

After restful is configured in yii2, a 404 error is reported under nginx

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中文网2782 days ago715

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-16 17:12:04

    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'

    reply
    0
  • Cancelreply