We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14617
    • 47 Posts
    Hi all.

    I have a problem that I think is cache related. I am caching the frontpage (and other) pages on a website (http://cultours.dk) but I have experienced more than once, that after a while the frontpage is being shown without grabbing the css. Has anyone experienced this before?

    Clearing the site cache and reloading the frontpage resolves the problem, but is of cause not an acceptable solution.

    All help is greatly appreciated

    Jonas
      • 25663 MODX Staff
      • 12,272 Posts
      Are you on a virtual server that uses cPanel/WHM? If so, turn off http monitoring and it should go away. What’s most likely happening is that you’re clearing the cache and then the internal HTTP monitoring agent is checking the index. Since it’s a http 1.0 user agent it’s not using the http_host server variable and you get the problem you’ve experienced. Alternately, you can hard-code the base-href into your template or use an uncached snippet to dynamically calculate it. Good luck!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 14617
        • 47 Posts
        Hey man

        Thanks for the quick reply. Just to make sure: you think changing
        <base href="[(site_url)]"></base>

        to
        <base href="http://www.cultours.dk/"></base>

        would correct the problem?

        Jonas
          • 25663 MODX Staff
          • 12,272 Posts
          It should indeed.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 10487 MODX Staff
            • 1,535 Posts
            FYI, the snippet method can be achieved as follows:

            Create a snippet called ’getSiteUrl’ and place this inside the snippet:
            return MODX_SITE_URL;

            Now, call the snippet uncached in your base tag:
            <base href="[!getSiteUrl!]"></base>

            Because the snippet is uncached, it won’t get caught out by the HTTP/1.0 requests causing a blank site URL to be cached. This method will help with sites where you do local development and then transfer to a live server, just one less thing to think about in the transfer process.
              Garry Nutting
              Senior Developer
              MODX, LLC

              Email: [email protected]
              Twitter: @garryn
              Web: modx.com