backend/config/main.php

'urlManager' => [

    'enablePrettyUrl' => true,
    'showScriptName' => false, 
    'enableStrictParsing' => false,
    'suffix' => '.html',
        'rules' => [
            '<controller:\w+>/<id:\d+>' => '<controller>/view',
        ],
],

如果在web文件夹下增加一个.htaccess文件,配置如下:

Options +FollowSymLinks 

IndexIgnore */* 

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

 

相关文章:

  • 2021-07-03
  • 2022-02-18
  • 2022-03-08
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-22
  • 2021-12-05
  • 2021-11-30
  • 2021-11-30
  • 2021-11-30
  • 2021-04-28
相关资源
相似解决方案