Answer the question
In order to leave comments, you need to log in
How to deal with slash at the end of URL in Yii2?
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
[
'class' => 'yii\rest\UrlRule',
'controller' => 'accounts'
],
'OPTIONS accounts/<account_uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}>' => 'accounts/view',
'GET accounts/<account_uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}>' => 'accounts/view',
'PUT accounts/<account_uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}>' => 'accounts/update',
'POST accounts' => 'accounts/create',
'OPTIONS accounts' => 'accounts/index',
'GET accounts' => 'accounts/index',
]
Answer the question
In order to leave comments, you need to log in
Good evening.
Try these settings.
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'suffix' => '/',
'normalizer' => [
'class' => 'yii\web\UrlNormalizer',
'normalizeTrailingSlash' => true,
'collapseSlashes' => true,
],
// остальные настройки urlManager
]
'suffix' => '/',
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question