We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    I don't see how it's happening, but I'm past my bedtime. wink

    If you have a page with that URL, it should still work and ignore the query string.

    If you type in one of these URLs, do you get a page?

    http://www.mydomain.com.au/library/strategy

    http://www.mydomain.com.au/library/strategy/
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 18367
      • 834 Posts
      Quote from: BobRay at Jul 22, 2014, 02:48 AM
      I don't see how it's happening, but I'm past my bedtime. wink

      If you have a page with that URL, it should still work and ignore the query string.

      If you type in one of these URLs, do you get a page?

      http://www.mydomain.com.au/library/strategy

      http://www.mydomain.com.au/library/strategy/

      Yeh, still daylight here.

      As for the above: without a / yes I get the right folder page
      With the / I don't (which is something else I need to look into later)

      FYI I've set the system settings up to not use / at the end of urls.

        Content Creator and Copywriter
        • 3749
        • 24,544 Posts
        It's a complicated set of rules. I think it's time to start disabling them selectively to see which rules are interfering with which other rules.

        I would start by disabling the MODX FURL rule and turning Friendly URLs off in System Settings. Get everything working, then reinstate the FURLs.

        Another thing to try is to check the uri field of the problem resources in the modx_site_content table in the DB. You can explicitly set the uri of a resource by clicking on the "Freeze URI" checkbox when editing the resource in the Manager.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 18367
          • 834 Posts
          Hmmm,

          I've tried all sorts of variations on the rewrite and most of them bring up the same
          http://www.mydomain.com.au/library/strategy?q=library/online-marketing
          result.

          Which I'm guessing means that a rewrite is taking place, it's just not returning the correct page.

          If I try the url up to the ?q it works fine.

          So the old folder is being rewritten and the destination folder exists but something in between isn't right. Got me beat.

          Would using the Redirector extra instead work better? And if so what would I put in it?
            Content Creator and Copywriter
            • 3749
            • 24,544 Posts
            I've never used Redirector, but maybe someone else can help.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 18367
              • 834 Posts
              I've spent days on this and learned a few interesting things but still no result.

              1: Don't mix Redirects and Rewrites in the same file. You can but it's not recommended.
              2: Clear the browser cache after updating the htaccess file. Didn't make any difference for me, but again it is recommended.
              3: Put all your rewrites before the Furls.
              4: Turning off all the other rewrite rules made no difference.
              5: Except for turning off furls which of course breaks everything.
              6: The redirect is working, it's just not showing the right page
              7: htaccess experts are hard to find.

              Must be beer o'clock, so I'm checking out.
                Content Creator and Copywriter
                • 3749
                • 24,544 Posts
                7: htaccess experts are hard to find.

                I definitely don't claim to be one. I consider myself fairly good with regular expressions, but I have yet to find a really good description of how the server processes the .htaccess rewrite rules and the quirks of dealing with the various conditions.

                I can usually write a regular expression for a fairly complex use case in one or two tries, but getting a non-trivial .htaccess rewrite rule to work always takes me forever.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 3749
                  • 24,544 Posts
                  BTW, sites like this can help:

                  http://htaccess.madewithlove.be/

                  You can paste in the whole .htaccess file and try various inputs to see what they get rewritten to.

                  Unfortunately, it doesn't handle REQUEST_FILENAME.

                  This looks promising, but I can't get it to work: http://martinmelin.se/rewrite-rule-tester/
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 18367
                    • 834 Posts
                    Weird progress of sorts.

                    I tried it in Chrome and it worked. Then I tried it in FF - didn't work. Then I tried IE, didn't work either.
                    (Cleared cahce several times just to be sure.)

                    Then I went back to Chrome and tried another rule. That didn't work, but the first one still does.

                    RewriteRule  ^library/online-marketing/(.*)$ /library/strategy/$1 [R=301,NC,L]
                    works

                    RewriteRule  ^library/ecommerce/(.*)$ /library/strategy/$1 [R=301,NC,L]
                    does not

                    They are identical apart form the one changed folder name.

                    Ugh Spoke too soon. Now northing's working in Chrome.

                    This is driving me mad.

                    Full file looks like this
                    Options +FollowSymLinks
                    RewriteEngine On
                    RewriteBase /
                    
                    RewriteRule  ^library/online-marketing/(.*)$ /library/strategy/$1 [R=301,NC,L]
                    
                    RewriteRule  ^library/ecommerce/(.*)$ /library/strategy/$1 [R=301,NC,L]
                    
                    # The Friendly URLs part
                    RewriteCond %{REQUEST_FILENAME} !-f
                    RewriteCond %{REQUEST_FILENAME} !-d
                    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
                    [ed. note: markg last edited this post 12 years, 2 months ago.]
                      Content Creator and Copywriter
                      • 3749
                      • 24,544 Posts
                      According to the tester here, both rules work perfectly: http://htaccess.madewithlove.be/

                      That suggests that the problem is not occurring on the first pass through .htaccess. If FURLs are working for you with other resources, it's not happening on any subsequent pass either.

                      I'm inclined to think that it's not an .htaccess problem any more. I'd look at stuff like publication status, security protection, container status, container suffix, incorrect resource URI, frozen resource URI, etc.
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting