mathiasa
(Aeschlimann Mathias)
October 24, 2016, 7:54pm
1
I use yii2 advanced template. I have two different domains, one pointed to the frontend, the other to the backend. I did this using MAMP Pro.
I activated pretty urls in my config:
[
'components' => [
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' => [
// ...
],
],
],
]
Url::to() works fine but the browser doesn’t find the pages. Do I have to put something in a .htaccess? So far I don’t have any .htaccess.
mathiasa
(Aeschlimann Mathias)
October 24, 2016, 8:44pm
3
thanks, this works - at least for controller/action but if I try controller/action/id I get an error 404 (an object with that id does exist). Do I have to tell config how to route this?
tri
(tri - Tommy Riboe)
October 24, 2016, 10:37pm
4
mathiasa
(Aeschlimann Mathias)
October 25, 2016, 8:53am
5
Oh, thanks, this works. But this way, I would have to make a rule for every model I have?
I just found out that the rules I used with Yii1 still work with Yii2, now I use, this does it for all models:
‘<controller:\w+>/<action:\w+>/<id:\d+>’=>’<controller>/<action>’,