这个是老师配置的
location / {
# index.php?r=index/index
# index.html
try_files $uri $uri/ /index.php?$args;
}
,但是在apache中我在index.php 同级目录创建 .htaccess
Options +FollowSymLinks
IndexIgnore */*
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
这是我的web.php 配置
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
// 'enableStrictParsing' => false, //不启用严格解析
'showScriptName' => false,
'suffix' => '.html',
'rules' => [
'<controller:(index|cart|order)>' => '<controller>/index',
'auth' => 'member/auth',
'product-category-<cateid:\d+>' => 'product/index',
'product-<productid:\d+>' => 'product/detail',
'order-check-<orderid:\d+>' => 'order/check',
[
'pattern' => 'admin',
'route' => '/admin/default/index',
'suffix' => '.html',
],
],
],
shop.imooc.com/inde.php/index.html 访问错误