We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 813 ☆ A M B ☆
    • 326 Posts
    Let me start by saying StatCache is an awesome add-on and is going to significantly speed up the project I'm working on.

    However, I'm having an issue getting it to play nice with some of my pages, and I believe it's because I've removed .html from my HTML content type. The cached page is served up, but it just displays the HTML as text onscreen.

    I've seen this page on the project's GitHub wiki, but can't get it to work:

    https://github.com/opengeek/statcache/issues/3

    Can anyone help me troubleshoot? I have a feeling it's a simple .htaccess fix. Thanks!
      • 22303 MODX Staff
      • 10,725 Posts
      You essentially need to change Apache to serve text/html as the default mime-type for files with no extension. It may depend on your Apache configuration and if you can override that in .htaccess whether the comments on issue #3 will help.
        • 813 ☆ A M B ☆
        • 326 Posts
        My .htaccess file is the default sample that comes with 2.2.5, and I added in these StatCache rules right after RewriteBase /:

        # If MODX is directly in your DOCUMENT_ROOT,
        # add this before your MODX Friendly URLs RewriteCond's and RewriteRule...
        RewriteCond %{DOCUMENT_ROOT}/statcache%{REQUEST_URI}~index.html -f
        RewriteRule ^(.*)$ /statcache/$1~index.html [L,QSA]
        
        RewriteCond %{DOCUMENT_ROOT}/statcache%{REQUEST_URI} -f
        RewriteRule ^(.*)$ /statcache/$1 [L,QSA]


        I then created another .htaccess file within statcache containing:

        <files *>
        ForceType text/html
        </files>


        However, this file gets deleted every time I "Clear Cache" from the top menu. How would I tell StatCache to ignore this .htaccess?
          • 22303 MODX Staff
          • 10,725 Posts
          I would fine a way to put that directive into the main .htaccess. Any Apache config experts know what that should look like in order to limit it to the statcache/ subdirectory?