how to enable pretty url in yii2

Solutions on MaxInterview for how to enable pretty url in yii2 by the best coders in the world

showing results for - "how to enable pretty url in yii2"
Jacopo
01 Jun 2016
1'urlManager' => [
2    'class' => 'yii\web\UrlManager',
3    // Disable index.php
4    'showScriptName' => false,
5    // Disable r= routes
6    'enablePrettyUrl' => true,
7    'rules' => array(
8            '<controller:\w+>/<id:\d+>' => '<controller>/view',
9            '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
10            '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
11    ),
12],
Luana
29 Mar 2019
1RewriteEngine on
2# If a directory or a file exists, use it directly
3RewriteCond %{REQUEST_FILENAME} !-f
4RewriteCond %{REQUEST_FILENAME} !-d
5# Otherwise forward it to index.php
6RewriteRule . index.php