I have a custom block where I have displayed an image. it's working nicely on all pages except login and registration page. On the login page when I inspect element and add "/" in scr before the image path, the image becomes visible.

on the other pages, the image has no issue with the bellow code.

<img src="sites/default/files/media/marketplace-logo.png?fid=511">

but on the login page, it's not displaying with the above src. and need a / before the path.

<img src="/sites/default/files/media/marketplace-logo.png?fid=511">

Why it's working on some pages and why are not working on login page with a / in the path.

  • 1
    This is NOT the same source. With slash is an absolute path, without slash is a relative path. – Hudri Mar 26 at 8:18
  • This is basic HTML sourcing/file behavior. You need a slash in front, otherwise it is path relative as Hudri says. – Kevin Mar 26 at 12:22

Browse other questions tagged or ask your own question.