O'Reilly logo

Yii2 By Example by Fabrizio Caldarelli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Customizing a URL in the advanced template

When working with multiple applications in the same project, you might require access from an application to another, for example, from the backend to a frontend link. This is because we want to display public page rendering in the frontend after inserting data in the backend.

The urlManager property is customized with references about the application where it is defined. However, we can add specific properties to refer to the respective application.

Therefore, in common/config/main.php, we can add these two properties:

 'urlManagerFrontend' => [ 'class' => 'yii\web\urlManager', 'baseUrl' => '/yiiadv/frontend/web', 'enablePrettyUrl' => true, 'showScriptName' => false, ], 'urlManagerBackend' => [ 'class' ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required