Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php yii2中的URL管理器问题_Php_.htaccess_Yii2 - Fatal编程技术网

Php yii2中的URL管理器问题

Php yii2中的URL管理器问题,php,.htaccess,yii2,Php,.htaccess,Yii2,这是我的后端url:http://localhost/game_website_new/phase1/admin/工作正常,但是 现在我在我的应用程序目录中有一个论坛文件夹,它可以在前端像这样访问:http://localhost/game_website_new/phase1/forum正在工作 但是我想在后台使用论坛,就像这样:http://localhost/game_website_new/phase1/admin/forum但这不起作用 下面是我的网站.htaccess文件 # pre

这是我的后端url:
http://localhost/game_website_new/phase1/admin/
工作正常,但是

现在我在我的应用程序目录中有一个
论坛
文件夹,它可以在前端像这样访问:
http://localhost/game_website_new/phase1/forum
正在工作

但是我想在后台使用论坛,就像这样:
http://localhost/game_website_new/phase1/admin/forum
但这不起作用

下面是我的网站
.htaccess
文件

# prevent directory listings
Options -Indexes
IndexIgnore */*

# follow symbolic links
Options FollowSymlinks
RewriteEngine on
RewriteRule ^admin(.+)?$ backend/web/$1 [L,PT]
RewriteRule ^(.+)?$ frontend/web/$1
你可以去
config
(如果您在应用程序的
common/config
)文件夹中使用高级应用程序,然后打开
web.php
main.php
,您将看到类似的内容

$config = [
      'urlManager' => [
      //some configs here
      ],
搜索“urlManager”以查找配置文件

看看上面的医生

我想这应该行得通

$config = [
    'urlManager' => [
                'enablePrettyUrl' => true,
                'showScriptName' => false,
                'enableStrictParsing' => false,
                'rules' => [
                    //you can use regexp in parameters
                    'your/new/url/<parameterId:\d+>' => 'old/url', // old url will match something like moduleIfYouHaveOne/YourController/YourAction
                    'phase1/admin/forum' => 'phase1/forum',
                ],
$config=[
“urlManager”=>[
“enablePrettyUrl”=>true,
'showScriptName'=>false,
'enableStrictParsing'=>false,
“规则”=>[
//可以在参数中使用regexp
'your/new/url/'=>'old/url',//旧url将与moduleIfYouHaveOne/YourController/YourAction匹配
“阶段1/管理/论坛”=>“阶段1/论坛”,
],