We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    It’s not closed until it’s committed wink
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 12652
      • 228 Posts
      Quote from: krausee at Oct 05, 2006, 04:44 PM

      I’d take out the R=301 if you don’t want to see the rewritten URL.

      I had a little different problem caused by using Apache 1.3(.31) under Win32. I had capital letters in the friendly URLs which Apache went and forced to lowercase. I finally got it worked out by adding a third rewrite condition:
      RewriteCond %{REQUEST_URI} ^/[^/]*(.*)$

      then changing the rewrite rule to:
      RewriteRule ^(.*)$ index.php?q=%1 [L,QSA]

      The condition assumes that MODx is installed in a subdirectory. The backreference to the condition provides the proper case for the alias. I don’t know if this behavior still exists in newer Apache versions.

      Erik

      Haven’t read this whole thread yet, and maybe this wasn’t available in that version, but have you tried adding the no case [NC] flag to your rewrite rules? This makes it case-insensitive.
        | Identity Developments delivers SEO focused web design and web presence services
        - it's not about websites, it's about your identity. |
        • 16312
        • 3 Posts
        Quote from: identity at Oct 08, 2006, 11:05 PM

        Haven’t read this whole thread yet, and maybe this wasn’t available in that version, but have you tried adding the no case [NC] flag to your rewrite rules? This makes it case-insensitive.

        It’s a wierd problem that’s only in the Win32 version (at least 1.3.31 +/- a few). The mod_rewrite stuff works fine, but passes a forced-to-lowercase alias to the MODx index.php causing array_key_exists to return false when searching for the alias. There seems to have been an assumption in Apache that if your file system is case insensitive, then you wouldn’t care if file names are forced to lowercase. Which is true enough for file names, but not helpful in this situation.

        Conveniently, most people don’t seem to be dense enough to be running old apache on a questionable OS.
          • 4643
          • 34 Posts
          Hi everyone!

          I’m storing my css files in a subfolder /templates/ under the site root and it seems to work but not for the Google sitemap files (I want "my own" CSS and scripts separate from MODx so I don’t mess up anything when updating MODx, or if I want to copy the layout of this site to another, non-MODx site etc).

          I have a Google sitemap XSL style sheet on site root level, that calls BOTH a CSS file and a javascript:

          <link href="/templates/sitemap.css" type="text/css" rel="stylesheet"/>
          <script src="/templates/sitemap.js"></script>

          The CSS link works, but the javascript does not if one, or both of {sitemap.css, sitemap.js} are MODx database files.

          If however I have "real" files in the "real" subdirectory /templates, it works fine. But I need BOTH files to be "real" for the javascript to execute.

          I have tried many combinations of "Base HREF...", or linking inside the CSS like [~n~] etc but the best I can achieve is that I can view the sitemap (so the CSS works) but the javascript is not executing.

          I saved the files using a blank template. The javascript as text/javascript type, the CSS file as text/css and the XSL stylesheet as text/xml.

          Any good clues or hints anyone?
            • 4643
            • 34 Posts
            Hi!
            Follow-Up: (I should have tested this before writing my first post above...):

            It seems that my main CSS doesn’t work either, so it is probably something I’m doing wrong with linking to CSS sheets in my subdir. This is what I have in my main site template:

            <base href="http://www.mysite.com/">
            <link href="/templates/styles.css" rel="stylesheet" type="text/css" />

            and it works fine when I have a "real" CSS file in the "real" folder /templates.

            I also suspected that maybe I can’t have BOTH a "real" folder /templates and a MODx folder /templates (I would assume in those cases that MODx "merges" the two and where conflict, chooses the MODx document) so playing it real safe, I tried deleting the "real" folder /templates. But that didn’t work either.
              • 7923
              • 4,213 Posts
              Check list for carlotto:

              1. put <base href="[(site_url)]"> to the head of your template.
              2. make sure that your css modx documents have alias like "styles.css" (including the .css, it will override the default suffix)
              3. make sure that your js modx documents have alias like "scripts.js" if you have any js docs.
              4. make sure that the css documents have the content type of "text/css" and js docs have "text/javascript"
              5. make sure that the css/js documents have template set to blank
              6. Link to your css/js file(s) using:
              <link href="templates/styles.css" rel="stylesheet" type="text/css" /> <!-- the css document is in MODx in a folder called templates -->
              <script src="scripts/scripts.js" type="text/javascript"></script>  <!-- the css document is in MODx in a folder called scripts -->
              

              An you of course need to have friendly alias paths enabled in MODx for this to work.

              7. Uncomment the following lines in your .htaccess file (or add if they are not there):
              BrowserMatch "MSIE" brokenvary=1
              BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
              BrowserMatch "Opera" !brokenvary
              SetEnvIf brokenvary 1 force-no-vary
              


              Try to view your page to see if it works (make sure to clean browser cache and modx cache first). Then try to view it with IE to see if it works. Some say that for the css to work perfectly in IE, it has to be linked using css import. If that’s the case, use:

              <style type="text/css">
              @import url('templates/styles.css');
              </style>
              


                "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                • 4643
                • 34 Posts
                Thanks! Good reply - the checklist seems to cover everything. I had actually done most of it (except the uncommenting in the .htaccess - done that now but no difference). So I must be doing something wrong still...

                Concentrating on the CSS only (to isolate the problem) - if I move it out to the site root and change the ref accordingly in the template, it works fine. But with the CSS inside the /templates folder, it does not. So the CSS itself should be correct (right type, alias etc) and it should be a problem with referencing it.

                I tried referencing it with both
                <link href="/templates/styles.css" rel="stylesheet" type="text/css" />
                which should have worked regardless of the base href and
                <link href="templates/styles.css" rel="stylesheet" type="text/css" />

                Both the above works if I put the "real" file in there, but not with the MODx CSS file.

                Anyway - thanks for the checklist, it’s very good. I must be doing something very odd elsewhere but I’ve worked around it for now by moving things out to site root level and I think I can live with that. Still grateful for any tips though of other things that could be wrong in case someone has some more things to try.
                  • 30223
                  • 1,010 Posts
                  So what happens if you type in the address to yout css file directly in the location bar of your browser? Do you get a page not found error?
                    • 4643
                    • 34 Posts
                    TobyL - Thanks! I should have tested that before....why didn’t I think of that simple test.

                    You put me on the right track - and the error turned out to be embarrasingly simple:

                    The MODx folder /templates wasn’t named /templates - but /Templates...and this site is on a Linux server. I’m not used to Linux servers, I have my other sites on a Windows server so I never had to bother with upper/lower case before.

                    Anyway - the really confusing bit was of course that I named the subfolder /Templates in MODx - but when I added a "real" folder to the site, I probably made that /templates. That would explain why putting "real" files in the "real" folder worked but not any of the database driven ones.

                    I am very grateful for the time you all have spent in trying to help me out here and I hope I haven’t been too much of a pain with this silly mistake.
                      • 11235
                      • 16 Posts
                      so.. there’s still no guide?

                      This discussion is closed to further replies. Keep calm and carry on.