1.通常都是先更改Apache的Apache\conf\httpd.conf文件中两个配置
但是基本都是配置好的,则无需再配置了
2.在yii的config文件下打开main.php
添加代码
'components' => [
//...已有代码...
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'suffix'=>'.html',
],
'log' => [
//...
],
3.在入口文件统计目录加入文件:.htaccess
内容为一下:
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
若更改过Apache配置,重启生效