- 在web文件夹下,新建.htacess文件,文件内容写入
# use mod_rewrite for pretty URL support RewriteEngine on # if a directory or a file exists, use the request directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward the request to index.php RewriteRule . index.php
- 在配置文件main.php中加入如下配置
//url美化管理 'urlManager' => [ //是否美化url 'enablePrettyUrl' => true, //是否隐藏入口文件index.php 'showScriptName' => false, //url后缀 'suffix' => '.shtml', 'rules' => [ ], ],
YII2 URL美化以及隐藏入口文件index.php
最新推荐文章于 2021-03-21 18:54:47 发布