'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'suffix' => '',
'rules' => [
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
],
],
当前配置是,在 apache 中配置了虚拟目录 /ad,所以访问链接:
会被重定向到 controller/TestController 中的 actionTest;由于虚拟目录的关系, index.php 没有被隐藏,可以通过在根目录下 rewrite 把所有未找到的文件重定向到 /ad/index.php 来解决,但是这样破坏了
yii 目录的独立性,所以还是保留了 index.php;
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'suffix' => '',
'rules' => [
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
],
],
当前配置是,在 apache 中配置了虚拟目录 /ad,所以访问链接:
要隐藏 index.php ,只需要在 .htaccess 文件中添加 RewriteBase /ad 即可