Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using path auto relative links break.
e.g.
If you have a block with an img that looks like:
<img src="sites/default/files/img.jpg">
Then visit some content that uses the alias content/node
the alias content is inserted into the img path, it comes up as content/sites/default/files/img.jpg which breaks the links.
Absolute links don't break or have the alias inserted. Only occurs when the actual domain is visited, not on temporary domains.
Not sure if clean urls affects it or not.
Comments
Comment #1
Dave ReidThis is how 'href' values in links and images work by default. If you don't provide a prefix of a slash character (e.g.
) then browsers interpret the links (such as
) as relative to the current page/URL.
You can also use a module like Pathologic to convert inline links to full URLs.
Comment #2
nicxvan CreditAttribution: nicxvan commentedThank you! I actually knew that, but for some reason I didn't make the connection.
Pathlogic looks great too.
Comment #2.0
nicxvan CreditAttribution: nicxvan commentedfixed code tag