无法在 cpanel 中路由 yii2 应用程序

Unable to route the yii2 application in cpanel

我已经将我的 yii2 项目上传到我的 cpanel。我的 url 别名是 xyz.com。下面是我的索引和 ht 访问文件

Index.html

<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
    $uri = 'https://';
} else {
    $uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/backend/dashboard/');
exit;
?>
Something is wrong :-(

Index.php

<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../../common/config/bootstrap.php');
require(__DIR__ . '/../config/bootstrap.php');

$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../../common/config/main.php'),
require(__DIR__ . '/../../common/config/main-local.php'),
require(__DIR__ . '/../config/main.php'),
require(__DIR__ . '/../config/main-local.php')
);

(new yii\web\Application($config))->run();

.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

结构

在我的本地机器上。 URL 是 localhost/backend/web。在我的生产服务器上,我想要访问的 URLxyz.com。但我只能访问 xyz.com/backend/web.

如果我点击 URL xyz.com 我会收到 Something is wrong :-( 消息。

如果我删除 index.html 文件,则会收到 This page isn’t working 消息。

如何访问它?任何帮助将不胜感激。

在.htaccess

<IfModule mod_rewrite.c> 
  RewriteEngine on

  RewriteRule ^(.*)$ backend/web/ [L] 
</IfModule>