We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46580
    • 167 Posts
    As expected when I type URL with invalid resource /path modX redirects to the site start page.

    But for subdomains with invalid URL (i.e. http://sub.mymodx.net/fake/path) I get a "503 error Page not found The page you requested was not found." with "Error 404" as page title, not a redirection although the 'site_start' resource ID is defined in context settings.

    I there a way to set up a custom error/redirect page for other contexts/subdomains ?

    modX 2.3.1 + xrouting

    This question has been answered by BobRay. See the first response.

      MODX lover
      -
      Développeur MODX / Webdesign / Solutions web
    • discuss.answer
      • 3749
      • 24,544 Posts
      Have you tried creating an error_page Context Setting, with an ID pointing to a page in that context?
        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
      • Is it a proper subdomain? If it's just in a subdirectory, then you need to have it in the .htaccess file for the subdirectory installation
        Rewrite Base /subdir/

        and access it with the subdirectory
        mydomain.com/subdir/


        If it's a MODX context, and not a real subdomain or subdirectory, then you need a modification in your .htaccess file to tell it to rewrite anything beginning with "sub". See this tutorial for examples.
        # The Friendly URLs part
        # detect language when requesting the root (/)
        RewriteCond %{HTTP:Accept-Language} !^de [NC]
        RewriteRule ^$ en/ [R=301,L]
        RewriteRule ^$ de/ [R=301,L]
         
        # redirect all requests to /en/favicon.ico and /de/favicon.ico
        # to /favicon.ico
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(en|de)/favicon.ico$ favicon.ico [L,QSA]
         
        # redirect all requests to /en/assets* and /de/assets* to /assets*
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(en|de)/assets(.*)$ assets$2 [L,QSA]
         
        # redirect all other requests to /en/* and /de/*
        # to index.php and set the cultureKey parameter
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(en|de)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
        - See more at: http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html#sthash.PJie4Zdt.dpuf

        http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html

        When you see the default server error message, that means it's not even getting far enough to pass on to the MODX index.php file. In your case, it's not finding the subdomain, so it isn't even trying to go looking for files in it.
          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
          • 46580
          • 167 Posts
          Quote from: BobRay at Aug 05, 2014, 03:59 AM
          Have you tried creating an error_page Context Setting, with an ID pointing to a page in that context?

          it works. Thanks ! No need to deal with htaccess (@sottwell: real subdomains : alias defined with ISPconfig3, subdirectory, xrouting)
            MODX lover
            -
            Développeur MODX / Webdesign / Solutions web