We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Seems to me there could be a plugin to replace the default system friendly url suffix with .css if the document’s filetype is set to text/css. Would that work? Should be easy enough to throw one together and give it a try, I suppose.

    Well, after working it out, nasty regular expressions, parsing the documentContent, testing for contentType, and successfully replacing the [~xx~] with the given document’s alias with a .css suffix, I got hit over the head with a clue stick...changing the document’s suffix to .css when the default suffix is .html means that the document isn’t found at all. rolleyes

    So my workaround is for the default url filename suffix to be blank, and I put suffix and all in the alias. So mydocument.html comes out nicely as mydocument.html, and mystylesheet.css likewise. I don’t know if this will solve the problem of IE trying to display the file; don’t see why it shouldn’t.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 25663 MODX Staff
      • 12,272 Posts
      That’s exactly how it should work indeed... maybe we’ll get that done for 0.9.2. Any idea on how to make it work that way?
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        I think that it would require some complex conditionals in the .htaccess file. Not familiar enough with that to know right off how it would go, but I’m sure the answer lies there. Right now, it rewrites all filenames to add the default (eg .html), but it should be able to know that if a file’s content-type is text/css to not rewrite it (or text/javascript, or text/pdf or whatever...). Then the plugin I managed to make that actually searched for and found all instances in the beginning documentContent of [~xx~] where the content-type of document xx was text/css, then replaced those tags with alias + .css. So now the link is actually to alias.css, and the rewrite engine won’t touch it. I think. I think I’ve confused myself now huh
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org