- composer 下安装号YII2.0后
- PhpStudy 配置
我用的是Apache
这里一定要选到YII安装目录的web目录,端口号重置下。配置好以后 就可以访问了 - 隐藏index.php
'urlManager' => [
'enablePrettyUrl' => true,//路由的路径化
'showScriptName' => false,//禁止严格url解析
'enableStrictParsing' => false,//允许去掉index.php
'rules' => [
"<controller:\w+>/<action:\w+>"=>"<controller>/<action>",
"<controller:\w+>/<action:\w+>/<id:\d+>"=>"<controller>/<action>",
"<controller:\w+>/<id:\d+>"=>"<controller>/view",
],
],
- 开启Rewrite
- 配置.htaccess,位置一定是web目录下
Options +FollowSymLinks
IndexIgnore /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php