Reputation: 1141
Where should I put this code:
'urlManager' => [
'enablePrettyUrl' => true,
'rules' => [
// your rules go here
],
// ...
],
And what rules should I put there?
Upvotes: 0
Views: 77
Reputation: 33538
You need to put it inside application config.
Its location varies depending on template you are using (basic / advanced).
There is components
section, where each framework component configured:
return [
'components' => [
'urlManager' => [
'enablePrettyUrl' => true,
'rules' => [
// your rules go here
],
// ...
],
],
];
This will prevent passing route passed as $_GET
parameter r
.
Note that for pretty urls you also need to add this:
`showScriptName` => false,
This will prevent showing index.php
in urls.
As for rules - it's more extensive question. Its content depends on your needs. You can configure route / group of routes / all routes.
Read more in official docs:
Upvotes: 1