Container / friendly url is buggy?

i managed to make friendly urls work, but when i check the ‘container’ checkbox in a document, when i view the page i only view the html, the css is missing.

am i missing something?


MODX version 2.7.1, mysql and apache

Look at the page source and click on the link to the CSS file. I’m assuming there’s a pathing issue to do with too few or too many slashes.

the weird thing is it works with friendly urls, just not when container is ticked

When using alias paths with containers (e.g. URLS are container/resource.html), you need to either add a <base href="[[!++site_url]]"> to the <head>, or make sure that you’re using absolute URLs.

For assets, absolute URLs means they have to start with a slash. So /assets/styles/main.css instead of assets/styles/main.css.

For MODX URLs, you can set the url_scheme system setting to abs to make sure generated URLs start with a slash, too. Some extras (e.g. Wayfinder) have a &scheme property you may also need to set to abs to achieve the same results in links they generate internally.

I did add base href

should i try setting url_scheme to abs?

I came across a really crazy issue trouble shooting last night that centred around resources with ‘container’ ticked.

Does this ONLY affect the container pages in your site while their child pages are OK?

(This is a long-shot question, but the behaviour I saw last night was so weird and never-seen-before that I’m just looking for anyone who mentions similar issues.)

What have you set the value to be?

If you’re using the [[++site_url]] system setting then this should already be a full path (abs) to the ‘top’ of the site.

If you’re setting it per page to the URL of the page, then the css won’t be able to build on that path and still and be in the same place for each page.

i have this in my <head>

<base href="[[!++site_url]]" />

Yeah - that tag should just echo that value and not be affected by &scheme

And that’s working on all pages that are not ‘containers’? Is this site somewhere we can preview what’s happening?

unfortunately its on localhost

Im just trying to learn this thing!

but i do appreciate you trying to help

many many thanks

All good - so now, can you confirm: the CSS is working on ALL pages which are NOT containers (as best you can tell) and IS NOT working on ALL pages which ARE containers?

If that’s the case and you’re comfortable with database editing then I might have something I can recommend.

Alternatively, could you please post a sample of the ‘base’ tag from both a working and non-working page so we can try to diagnose what’s happening?

yes exactly, css on pages not containers is working

i can try the database editing but its not necessary, just trying to learn modx :slight_smile:

the base tag is the same for all pages, I am using a chunk for the head

Sorry this is amongst your first experiences wiht MODX - it definitely sounds like a non-typical problem!

Are you familiar with Chrome’s Developer tools? Taking a look at the results from those is the next step I’d take in diagnosing. Open those and look at the Network tab as you load a working and non-working page and see what it says about the CSS loading.

i checked, its trying to get the css from


when it should be


another page is a dummy page i created, with container checked

Is your base element defined above the css link call? It is evaluated in source order.

1 Like


its at the bottom of the head, so under the css link

1 Like

that was the problem, thanks sir, much appreciated, and you too jcdm


Glad you got it sorted! Good sleuthing Jay!


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.