Answer the question
In order to leave comments, you need to log in
How to properly generate links in yii2?
Good day.
Faced with the problem of generating links. Everything works fine on the server, but not so well locally. On the server, the link should look like "dom.com/admin/index.php" and locally it should look like " 127.0.0.1/dom/backend/web/index.php "
This is how one of the links is created:
$items[] = [
'label' => \Yii::t('auth', 'Admin Panel'),
'url' => '/admin/index.php'
];
Answer the question
In order to leave comments, you need to log in
It looks like your local web server is misconfigured. Do something like this
Root folder for Frontend: "/dom/frontend/web"
Root folder for Backend: "/dom/backend/web"
And, accordingly, approximately the following domain names (in hosts):
Frontend: dom.loc
Backend: admin .dom.loc
And, by the way, you don't generate urls correctly either. It is necessary like this:
I.e. without ".php"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question