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' => 'yii\web\urlManager', 'baseUrl' => '/yiiadv/backend/web', 'enablePrettyUrl' => true, ...