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
    Victor didn’t say to not use Mod_rewrite, just that the specific implementation kills "real" error logs.

    IIS requires another hack entirely to get it to work, too, as it doesn’t support mod_rewrite.
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 22303 MODX Staff
      • 10,725 Posts
      I’m just saying there is no other current way to implement it. We can’t handle those requests to virtual resources unless we create physical files for every page published in the CMS or affecting other rewrite rules users may have in their environments. Extending it so that our error page process sends the proper code is great, but that should be a matter of setting headers and generating specific pages ignored by the rewrite rules even though it doesn’t exist.
        • 31337
        • 258 Posts
        This is my point exactly -- get away from mod_rewrite or any IIS hacks. Let the webserver deliver the request normally, and also log the response normally.

        Without diving into the code, it seems that we already have a mapping internally of a "friendly url" for each page we create, correct? I am suggesting that we just set up a dispatch mechanism to look at that mapping globally and serve up the right page. Does that make sense? If not, let me know and I’ll write up something more comprehensible tonight.
          • 22303 MODX Staff
          • 10,725 Posts
          No Victor, that won’t work (unless I’m missing an important technique), because we are handling virtual requests to pages and directories that do not exist on the webserver. Without this, they’ll all come back as page not found. If you think about it, every MODx request is to index.php with a query string to identify the resource. If someone looks up a page by friendly URL, then that resource will not exist on the server except virtually within MODx, and the webserver is already returning the error code.
            • 22303 MODX Staff
            • 10,725 Posts
            I personally think we’re better off providing some .htaccess control from the manager or plugins (similar to WordPress writing it’s own .htaccess, or the Feedburner plugin) to provide more robust control over this stuff...rather than trying to get away from it. I honestly have grown to love the flexibility and control I have over my sites with mod_rewrite.
              • 31337
              • 258 Posts
              Quote from: OpenGeek at Nov 08, 2005, 11:14 AM

              No Victor, that won’t work (unless I’m missing an important technique), because we are handling virtual requests to pages and directories that do not exist on the webserver. Without this, they’ll all come back as page not found. If you think about it, every MODx request is to index.php with a query string to identify the resource. If someone looks up a page by friendly URL, then that resource will not exist on the server except virtually within MODx, and the webserver is already returning the error code.

              I think we’re talking about the exact same thing here smiley

              When I turn on friendly URLs and I request /foo.html from the site, the rewrite rule simply redirects me to index.php and passes along foo.html as a parameter -- at which point the index.php file knows what to do with it. Correct?

              What I am suggesting is creating a mechanism that’ll accept *any* request (this is easy to do with Apache and IIS) and then process that internally based on the virtual document that should be returned (or not -- in the case of errors).

              Does that make more sense?
                • 25663 MODX Staff
                • 12,272 Posts
                Quote from: OpenGeek at Nov 08, 2005, 11:17 AM

                I personally think we’re better off providing some .htaccess control from the manager or plugins (similar to WordPress writing it’s own .htaccess, or the Feedburner plugin) to provide more robust control over this stuff...rather than trying to get away from it.  I honestly have grown to love the flexibility and control I have over my sites with mod_rewrite.
                Totally agree here. The .htaccess as appropriate could be generated during install based on me seeing Victor’s kickstart installer mojo.

                Whether or not a dispatcher would work I have no idea, but that seems to me like a lot of work... :/

                I’d honestly much prefer to see a solid friendly aliases path implmentation myself so we could have identical aliases at multiple levels.

                A good dispatch mechanism could also allow us to build dynamic pages on the fly using tags, too though, which would be cool. This is one of the things that Travis actually did have implmented, althogh the details are a bit sketchy as far as I remember. For big sites, this is a very cool thing.
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 25663 MODX Staff
                  • 12,272 Posts
                  Quote from: vbrilon at Nov 08, 2005, 11:20 AM

                  What I am suggesting is creating a mechanism that’ll accept *any* request (this is easy to do with Apache and IIS) and then process that internally based on the virtual document that should be returned (or not -- in the case of errors).
                  If all requests are being passed along as a parameter, how will you ever get your 404s to register in your apache logs?
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 22303 MODX Staff
                    • 10,725 Posts
                    The way to handle this would be with a rewrite condition and setting up a real php page for errors, or a specific rewrite rule to handle the errors in an alternate virtual processor.
                      • 25663 MODX Staff
                      • 12,272 Posts
                      Could we set up a "custom error page" header in MODx that sends the 404 response along with the request to the Apache error logs? If so, then I think we’ve got a better solution that covers all bases.
                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me