We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32678
    • 290 Posts
    I'm trying to add a sitemap.xml to a single-page website and encountering a 404 error when I load the page. I get the same error for any page that doesn't exist, despite that fact that I set site_unavailable_page as the site's root resource.

    Not Found
    
    The requested URL /sitemap.xml was not found on this server.
    
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


    I tried uninstalling SEOPro, thinking perhaps this was somehow creating a conflict, but no dice.

    If site_unavailable_page is set, then any bad URL should forward, correct?

    Also, I believe this is unrelated, but when I turn on htaccess and rewrite to www, I get a site unavailable error (in Chrome).

    This is modx 2.3.2 on a Skytoaster box.
      • 3749
      • 24,544 Posts
      The site_unavailable_page only setting is only used if the site_status System Setting is set to off (0).

      It's the error_page that the user gets forwarded to when the original page isn't found. The message is saying that the original page wasn't found *and* the error_page wasn't found (usually because the error_page System Setting points to the ID of a non-existent or unpublished page).
        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
        • 32678
        • 290 Posts
        Quote from: BobRay at Feb 02, 2015, 09:28 PM
        The site_unavailable_page only setting is only used if the site_status System Setting is set to off (0).

        It's the error_page that the user gets forwarded to when the original page isn't found. The message is saying that the original page wasn't found *and* the error_page wasn't found (usually because the error_page System Setting points to the ID of a non-existent or unpublished page).

        Ah, thanks. So many settings, so little time.

        error_page is set to the default of 1, which is a resource that exists and is published. Any ideas on why I'd still get the 404, in this case?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The 404 error you are getting is from the server, not from MODX. This usually happens if the .htaccess file is not configured correctly. Basically it means that the server doesn't find the requested file, and doesn't know to pass it on to index.php, or cannot find the index.php file.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 32678
            • 290 Posts
            Quote from: sottwell at Feb 03, 2015, 12:34 PM
            The 404 error you are getting is from the server, not from MODX. This usually happens if the .htaccess file is not configured correctly. Basically it means that the server doesn't find the requested file, and doesn't know to pass it on to index.php, or cannot find the index.php file.

            Thanks. That makes sense. As mentioned earlier in this string, turning on htaccess leads to a site not found error. I need to dig into this -- I've configured several htaccess files for ModX previously and have not encountered issues.

            One clarification that would be helpful is how to use the htaccess in the manager directory. I have never done anything with this file, but have been told that I should configure it. The rtfm page on htaccess doesn't make mention of this. Is there a best practice that you follow?
              • 3749
              • 24,544 Posts
              The only function of the .htaccess file in the Manager directory is to turn off the rewrite engine so no rewriting happens at all. I think it's only necessary if you have a rewrite rule in the root that would do an unwanted rewrite of the name of a manager asset.

              When you implemented .htaccess in the root, did you also set the friendly_urls System Setting to 'Yes' and clear the cache?

              Do you have this in the head section of all templates?

              <base href=[[++site_url]] />


              Do you have more than one front-end context?

              Are you on a Windows or nginx server?

                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