We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18397
    • 3,250 Posts
    To check:

    [03:19 PM] MARKSVIRTUALDESK: go to any page on a modx install of x9,1
    [03:20 PM] MARKSVIRTUALDESK: now
    [03:20 PM] MARKSVIRTUALDESK: go to the 404 page
    [03:20 PM] MARKSVIRTUALDESK: by typing in a bad url
    [03:20 PM] MARKSVIRTUALDESK: and view the headers
    [03:20 PM] MARKSVIRTUALDESK: modx sends a 200
    [03:20 PM] MARKSVIRTUALDESK: instead of a 404!

    Etomite solution:

    http://www.etomite.org/forums/index.php?showtopic=2421&view=findpost&p=25213
      • 25663 MODX Staff
      • 12,272 Posts
      This ties in quite well with what Victor discussed regarding traditional stats tracking from Apache logs as well. Should be added to the 0.9.2 list I think.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 31337
        • 258 Posts
        Yep, this happens due to the mod_rewrite rule that maps any missing page to a redirect so that Apache never sees the error. So Apache thinks the request was handled ok and sends the 200 code. Where this *really* breaks for us is when you have sites that send 3xx (redirect) codes out to the clients. Granted thats mostly a corner case for most sites, but it’s still worth fixing.

        The Etomite fix is ok...kinda. It sends a 404 to the browser (which is the right thing), but the Apache logs still won’t record the 404 since we handled the request rather than passing it off to the 404 handler in Apache.

        I have an idea for a fix, I just need to test it. Soon as I get some sleep (some time in the next 12 months grin) I’ll get around to it

          • 22303 MODX Staff
          • 10,725 Posts
          I agree the header sent to the browser needs to be 404 when a virtual page is not found by MODx and we send a custom MODx error page. In order to address this at the Apache log level is another story. We could find a way to virtually log the error in Apache, but that is a hack at best don’t you think? Or we could simply have our error handler pass off the error to Apache (is this possible in any standard way?), but I don’t like that solution, cause now I have to go customize the Apache error pages to make them look like my site, and I have no access to MODx on that page (hard-coding here we come).

          Any other ideas? And Victor, if you want to share your idea, I’d be glad to test it out... wink
            • 31337
            • 258 Posts
            Quote from: OpenGeek at Jan 03, 2006, 07:26 PM

            I agree the header sent to the browser needs to be 404 when a virtual page is not found by MODx and we send a custom MODx error page. In order to address this at the Apache log level is another story. We could find a way to virtually log the error in Apache, but that is a hack at best don’t you think? Or we could simply have our error handler pass off the error to Apache (is this possible in any standard way?), but I don’t like that solution, cause now I have to go customize the Apache error pages to make them look like my site, and I have no access to MODx on that page (hard-coding here we come).

            Any other ideas? And Victor, if you want to share your idea, I’d be glad to test it out... wink

            The problem with not passing the status back to Apache is two-fold:
            1) It doesn’t get logged in the error_log. Yes, the ModX logging stuff is nice. But Apache logs are still needed since the world doesn’t exist strictly inside of MODx grin
            2) If I have a custom error page specified in the Apache config, I need a 404 to return that page, as (once again) my site may have stuff that exists outside of MODx

            I am still trying to wrap my brain around some of the interaction between PHP sending headers back, and how Apache deals with them. Fix coming soon I hope smiley
              • 22303 MODX Staff
              • 10,725 Posts
              Let’s just make sure I don’t have to customize 404 error pages, cause I don’t want that. I’d rather not have the 404 stats than have to manage pages external to MODx for the error pages. I guess what I’m hinting at is, it might be good to offer this as an optional solution for people who want the Apache log to reflect the 404’s and don’t mind maintaining custom Apache error pages.

              And what was that about the MODx logging stuff being nice? I never use the internal logging because it isn’t so nice, IMO, but... I just try to make sure if people go to a bad URL in my sites, they at least have a nice, friendly MODx page to display the site map, site search, or whatever else might be appropriate, or maybe even write a snippet to find potential matches for them.
                • 31337
                • 258 Posts
                Quote from: OpenGeek at Jan 03, 2006, 07:43 PM

                Let’s just make sure I don’t have to customize 404 error pages, cause I don’t want that. I’d rather not have the 404 stats than have to manage pages external to MODx for the error pages. I guess what I’m hinting at is, it might be good to offer this as an optional solution for people who want the Apache log to reflect the 404’s and don’t mind maintaining custom Apache error pages.

                Yeah I obviously didn’t mean we’d maintain those. Just saying that we should make that available for people who want it.

                Quote from: OpenGeek at Jan 03, 2006, 07:43 PM

                And what was that about the MODx logging stuff being nice? I never use the internal logging because it isn’t so nice, IMO, but..

                Hmmm...wish this forum had [sarcasm] tags to put in my original post grin
                  • 27065
                  • 1 Posts
                  This is really a killer for those who want to position their site properly in search engines. The google spider is known for trying all kinds of weird combinations all on its own, and after a while the index will be filled with copies copies of the custom error page. This can really mess up your position in the index.
                    • 5282
                    • 147 Posts
                    Hi !
                    I’ve juste installed the newest modx version ( 0.9.2.1 ), but the problem is still here ..... When i enter a wrong url, i get on the modx 404 error page, which sends a "200 OK" code ....
                      i’m not a native english speaker, sorry if there are any mistakes ! smiley

                      Pikkitux.com Website about Ubuntu Linux, Website Creation, and many other how-tos, tips and tricks ... ( French Language, and of course Modx Powered ! )
                      • 31337
                      • 258 Posts
                      The problem was actually fixed, and then accidentaly unfixed in the process of putting out the security release recently. Look for an update very soon with a fix (again grin)