tac con tty enable gin 2.0 sym yml dex
比如我的路由是 http://localhost/basic/web/?r=site/index
现在想改成 http://localhost/basic/web/site/index 的形式
第一步 在config/web/php里把urlManager的注释打开
- ‘urlManager‘ => [
- ‘enablePrettyUrl‘ => true,
- ‘showScriptName‘ => false,
- ‘rules‘ => [
- ],
- ],
第二步 在basic\web目录下创建.htaccess文件
在里面复制如下内容
- Options +FollowSymLinks
- IndexIgnore */*
- RewriteEngine on
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteCond %{REQUEST_FILENAME} !-d
- RewriteRule . index.php
就可以了
yii2.0如何优化路由
来源: http://www.bubuko.com/infodetail-2337040.html