We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10405
    • 288 Posts
    Hi, I'm trying to set up a folder on my site, outside the modX CMS- just a folder inside the www directory, where some database admin pages will sit.

    Using my hosting control panel I created a user and password for the folder, password protected the folder... but instead of bringing up the gray prompt box for credentials when I try browsing to it, it just goes through to the site home page (also the front page in MODx).

    So it looks as if MODx is somehow overriding the htaccess and stopping it from working.

    I assume mod_rewrite module must be working ok as I have friendly URLs switched on and the site itself is working fine.

    Any idea how this can be fixed? [ed. note: galahad5 last edited this post 14 years, 8 months ago.]
      • 10405
      • 288 Posts
      Ok... this is interesting. I set up a subdomain instead, pointing to the protected folder, and if I browse to the subdomain, the directory protection works.

      Clearly this is an issue with MODx stuffing up the host's htaccess settings- would be great if this is looked into by the developers as it seems a few people have encountered this issue.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        You'll need to exclude that directory from the .htaccess rewrite rules.
        RewriteRule ^(directory)/*$ - [L]

        That line has to go before the friendly URL rewrite directives; it basically say "if the request doesn't contain this..." [ed. note: sottwell last edited this post 14 years, 8 months ago.]
          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
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Has nothing to do with MODx itself, it's a rewrite issue. If every request to your domain has the rewrite rules applied to them, they get converted to index.php?q=whatever.html, which in this case doesn't match any MODx resources, and thus causes a 404 not-found, resulting in getting your default error page (usually the home page). Having the line excluding requests to that directory in the domain bypasses the rewrites to index.php?q=...

          Having it in a subdomain works because the .htaccess for your regular domain isn't applied to it at all.
            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
            • 10405
            • 288 Posts
            Thanks, when i get a minute I'll try the other method by editing the global .htaccess.