We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13993
    • 100 Posts
    So I was doing some testing. I created a document for a 404 error document. Well if I publish it, then you can go to /page-not-found.html and the page gives a 200 header and is a real page on the website. If I go to /not-real-file.html it throws up a 404 header and returns the error document.

    Well I don’t really want the 404 document to really be an indexable page on the website. So I unpublished it and it worked great in the fact it wasn’t a page on the site and going to /not-real-file.html returned the contents of the unpublished 404 document. The problem is, /not-real-file.html now returns a 500 header response. It really should read 404 error. There is an error happening somewhere.

    The contents of a 404 response should not need to be a published page on in ModX for it to work right.

    This is using 0.9.5 beta 5 rev 1624 but I assume this happens in all versions of ModX.
      • 22303 MODX Staff
      • 10,725 Posts
      Well I think it worked when you were logged into the manager since admins can view unpublished pages, then perhaps returns 500 when you log out? But at the moment, MODx requires a published error document to function properly. But, I don’t see anyway for us to fall through to the standard 404 page once we’ve started handling the request; at least not without a redirect of some kind. Perhaps some simple messages in the configuration could be used to provide content for error (and unauthorized) responses if no valid/published document is available to forward to, very similar to the site unavailable message and page options. What do you think?
        • 13993
        • 100 Posts
        I like the sending of the sitemap for a 404 message like in the example template setup that comes with a fresh install.

        I found a solution. I just setup the 404 file to add a noindex,follow meta tag in the head. This should solve all the issues. It also tells Google to take the page that threw the 404 out of their index which they are very slow in doing without telling them to.

        The ole noindex,follow should definitally be on everyones best practices list. I’ve seen way to many 404 pages stay in the search engines for a very long time.
          • 12652
          • 228 Posts
          On "regular" sites, I typically created an error directory to hold error pages, and then included that directory in the disallow in the robots.txt file.

          Being dynamic, things run a little differently, but wondering if the SE’s would treat it the same way if you created a pseudo-directory so that the browser would be going to yoursite.com/error/not-found.html ?
            | Identity Developments delivers SEO focused web design and web presence services
            - it's not about websites, it's about your identity. |