How To Enable Pretty Url In Yii2

[Solved] How To Enable Pretty Url In Yii2 | Php Frameworks Yii - Code Explorer | yomemimo.com
Question : how to enable pretty url in yii2

Answered by : splendid-shrew-0dejb3jw6wk2

'urlManager' => [ 'class' => 'yii\web\UrlManager', // Disable index.php 'showScriptName' => false, // Disable r= routes 'enablePrettyUrl' => true, 'rules' => array( '<controller:\w+>/<id:\d+>' => '<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>', ),
],

Source : https://stackoverflow.com/questions/26525320/enable-clean-url-in-yii2 | Last Update : Fri, 04 Sep 20

Question : how to enable pretty url in yii2

Answered by : splendid-shrew-0dejb3jw6wk2

RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php

Source : https://stackoverflow.com/questions/26525320/enable-clean-url-in-yii2 | Last Update : Fri, 04 Sep 20

Answers related to how to enable pretty url in yii2

Code Explorer Popular Question For Php Frameworks Yii