后端 url 在 yii 2 高级模板中损坏

backend urls broken in yii 2 advanced template

在站点中启用漂亮的 url 并设置 apache 虚拟主机后,后端导航中断,returns 所有页面均为 #404。

配置文件如下:

httpd-vhosts.conf 文件:

...
<VirtualHost nvp.dev>
  Alias /backend "d:/dev/htdocs/nvp/backend/web/"
  DocumentRoot "d:/dev/htdocs/nvp/frontend/web/"
  ServerName nvp.dev
  ServerAlias www.nvp.dev
</VirtualHost>

.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

common\config\main-local.php

'components' => [
  ...
  'urlManager' => [
        'enablePrettyUrl' => true,
        'showScriptName' => false,
    ],
]

我在这里错过了什么?

已修复。

如果有人遇到类似问题:

RewriteBase /backend

需要添加到位于 backend/web 目录的 .htaccess, 中。