Answer the question
In order to leave comments, you need to log in
How to organize a redirect to a page in Yii2 without a slash at the end?
Suppose there is a page address that ends with a slash... How to teach Yii2 when requesting such a page to perform a 301 redirect to the same page, but without a slash at the end? Plus, you need to remember about the parameters.
Answer the question
In order to leave comments, you need to log in
In general, this should be done through mod_rewrite:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'controller/action/' => 'controller/action',
]
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question