i have some code in HTML that gets parsed by PHP, and i want the image tags to be relative, because the code needs to work on multiple servers.
I have index.php
in the directory as the folder icons
, and in icons
, there is an image called logo.png
. The code is index.php
is like this:
echo '<img src="icons/logo.png">';
But does not work. However, if i change it to this kind of path (http://mydomain...
) it does work.
On one of the servers, both index.php
and icons
are in a subdomain directory, and on the other server they are in the root. In both cases the relative path does not work.
How can i fix this?
Thanks.
EDIT: In my HTML inspector, i can see that the URL to the image is correctly being parsed.