I want to change the Url.
This is what I have used but its not working in second case.It gives me 404
Case 1: user/view?id=35
[
'pattern' => 'view-user-<id>',
'route' => 'user/view',
'suffix' => '.php',
],
Case 1 result: view-user-35.php
Case 2: user/view?id=35&tab=4
[
'pattern' =>'view-user-<id>-<tab>',
'route' => 'view-user-<id>.php',
'suffix' => '.php',
],
Case 2 result: view-user-35.php?tab=4
but after refreshing the page it says 404 page not found.
Case 2 expected result : view-user-35-4.php.
Here tab="any number" is conditional. It can there or it can not be there.
Note: tab is appended by using javascript.
question from:
https://stackoverflow.com/questions/65840024/yii2-conditional-url-routing 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…