enablePrettyUrl in Advanced template affecting CSS

hi,

Thanks for reading.

Just like in Yii 1.1.14, I changed the directory structure after installing the advanced template in nginx server, so that the frontend ‘web’ directory is in the web root (WWW/) and backend ‘web’ directory is in web root (WWW/admin/). All other folders were taken behind the web root in a directory ‘adv’.

The index.php in webroot is changed as:

<?php

defined(‘YII_DEBUG’) or define(‘YII_DEBUG’, true);

defined(‘YII_ENV’) or define(‘YII_ENV’, ‘dev’);

require(DIR . ‘/../../adv/vendor/autoload.php’);

require(DIR . ‘/../../adv/vendor/yiisoft/yii2/Yii.php’);

require(DIR . ‘/../../adv/common/config/bootstrap.php’);

require(DIR . ‘/../../adv/frontend/config/bootstrap.php’);

$config = yii\helpers\ArrayHelper::merge(

require(__DIR__ . '/&#46;&#46;/&#46;&#46;/adv/common/config/main.php'),


require(__DIR__ . '/&#46;&#46;/&#46;&#46;/adv/common/config/main-local.php'),


require(__DIR__ . '/&#46;&#46;/&#46;&#46;/adv/frontend/config/main.php'),


require(__DIR__ . '/&#46;&#46;/&#46;&#46;/adv/frontend/config/main-local.php')

);

$application = new yii\web\Application($config);

$application->run();

The index.php in the admin folder in webroot was changed as:

<?php

defined(‘YII_DEBUG’) or define(‘YII_DEBUG’, true);

defined(‘YII_ENV’) or define(‘YII_ENV’, ‘dev’);

require(DIR . ‘/../../../adv/vendor/autoload.php’);

require(DIR . ‘/../../../adv/vendor/yiisoft/yii2/Yii.php’);

require(DIR . ‘/../../../adv/common/config/bootstrap.php’);

require(DIR . ‘/../../../adv/backend/config/bootstrap.php’);

$config = yii\helpers\ArrayHelper::merge(

require(__DIR__ . '/&#46;&#46;/&#46;&#46;/&#46;&#46;/adv/common/config/main.php'),


require(__DIR__ . '/&#46;&#46;/&#46;&#46;/&#46;&#46;/adv/common/config/main-local.php'),


require(__DIR__ . '/&#46;&#46;/&#46;&#46;/&#46;&#46;/adv/backend/config/main.php'),


require(__DIR__ . '/&#46;&#46;/&#46;&#46;/&#46;&#46;/adv/backend/config/main-local.php')

);

$application = new yii\web\Application($config);

$application->run();

The frontend and backend was working fine. But when added ‘urlManager’ in the configuration, the CSS of the website changed and the url links were not working when ‘enablePrettyUrl => true’ was written. I am attaching the screen shots. Where can be the problem? I have configured nginx.conf server as instructed in the advanced template installation guide.

6034

with-enablePrettyUrl.jpg

6035

without-enablePrettyUrl.jpg

I seek help, thanks.

Harikrishnan

It was only the ‘root’ in the ‘server’ of nginx.conf file which troubled me.

Solved!