H
H
hollanditkzn2017-06-14 17:32:00
Yii
hollanditkzn, 2017-06-14 17:32:00

Why does the image path change automatically?

In my template, the path to the image is indicated. <img src="img/holland.png">
But in all pages it is normally displayed, that is, such a path to the image crm/frontend/web/img/holland.png
But on only one page of the site, this path is somehow distorted and the path points to the image crm/frontend/web/custom/img/holland.png. The question is how to make the path not distorted?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-06-15
@qonand

Firstly, specifying a link in the style "img/holland.png" means that the link will be generated relative to the current page. That is, if you are on the mysite.com/page page, then your link will be generated as mysite.com/page/img/holland.png
Secondly, apparently you are using the Advanced template, which means that you need to configure your Apache so that there would not be this heap of nested folders and you could work with the front-end part as with a separate site. This will allow you to avoid a lot of problems with links. Well, if you do not want to do this, then form links using the Url helper, for example
Url::toRoute(['@web/img/image.png'], true)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question