Yii Framework Forum: backend shows the frontend pages - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

backend shows the frontend pages

#1 User is offline   Jaegyo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 05-September 17

Posted 13 September 2017 - 09:01 PM

Hi everyone, Our backend dev is having quite an issue because the backend shows the files of the frontend. and I can't answer him because I don't know why it's doing that.

Here's the appasset of the backend.

<?php

namespace backend\assets;

use yii\web\AssetBundle;

/**
* Main backend application asset bundle.
*/
class AppAsset extends AssetBundle
{
  public $basePath = '@webroot';
  public $baseUrl = '@web';
  public $css = [
      'css/site.css',
  ];
  public $js = [
      'js/main.js',
  ];
  public $depends = [
      'yii\web\YiiAsset',
      'yii\bootstrap\BootstrapAsset',
  ];
}


Here's the main.php file located on the backend/config/ folder

<?php
$params = array_merge(
   require(__DIR__ . '/../../common/config/params.php'),
   require(__DIR__ . '/../../common/config/params-local.php'),
   require(__DIR__ . '/params.php'),
   require(__DIR__ . '/params-local.php')
);

return [
   'id' => 'app-backend',
   'basePath' => dirname(__DIR__),
   'controllerNamespace' => 'backend\controllers',
   'bootstrap' => ['log'],
   'modules' => [],
   'components' => [
       'user' => [
           'identityClass' => 'common\models\User',
           'enableAutoLogin' => true,
       ],
       'log' => [
           'traceLevel' => YII_DEBUG ? 3 : 0,
           'targets' => [
               [
                   'class' => 'yii\log\FileTarget',
                   'levels' => ['error', 'warning'],
               ],
           ],
       ],
       'errorHandler' => [
           'errorAction' => 'site/error',
       ],
       'authManager' => [
                          'class' => 'yii\rbac\DbManager',
                          'defaultRoles' => ['guest'],
         ],
       /*
       'urlManager' => [
           'enablePrettyUrl' => true,
           'showScriptName' => false,
           'rules' => [
           ],
       ],
       */
   ],
   'params' => $params,
];


can you please let me know your thoughts. I'm new to Yii2 and can't find similar questions here.
0

#2 User is offline   chandran 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 562
  • Joined: 08-October 12
  • Location:Austria

Posted 20 September 2017 - 05:23 AM

Hi

I think you gave 'basePath' => dirname(__DIR__), same for both frontend and backend.. Please check that.. it should be different then only it will redirect to correct page..

I mean www.test.com/backend or mostly www.test.com/admin
and for frontend www.test.com

Please check and revert
Thanks
chandran nepolean

My own extension:
http://www.yiiframew...sion/ejqueryte/
http://www.yiiframew...uallistboxyii1/

My wiki
http://www.yiiframew...checkboxcolumn/

If it work dont hesitate to click +1 button
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users