Reputation: 545
I was having a lot of trouble getting relative links working in MODx. As soon as I made a container and put some pages one level above the root, nothing was linking correctly. Lots of missing images and broken links.
Upvotes: 1
Views: 573
Reputation: 1172
StingyB's answer is correct. This tag should be in the head section of all MODX templates:
`<base href="[[++site_url]]" />`
Note that if you have multiple front-end contexts, the placeholder should be uncached:
`<base href="[[!++site_url]]" />`
Also, it must be a short tag. This will not work:
`<base href="[[!++site_url]]"></base>`
I'm not sure where comment about "breaking all links linking to content identifiers" is coming from. These tags are standard in all MODX installs.
Upvotes: 0
Reputation: 545
NOTE: This fix apparently will break all links linking to content identifiers.
I fixed it by putting the following at the top of the web template:
<base href="[[++site_url]]" />
You have to use that. If you hardcode it, it will screw up depending on which protocol you use, http or https.
Upvotes: 4