We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38713
    • 91 Posts
    alexmercenary Reply #1, 10 years ago
    Hi Guys,

    I'm sure this is gonna be something that's simple to achieve and I'm just not thinking straight but say I have a directory in my webroot directory called "dev"

    When I go to www.domain.com/dev how can I get MODX to stop redirecting this URL. I get that it's doing it because there the resource doesn't exist within MODX but I need to make an exception.

    Thanks
      Twitter @alexmercenary
    • The problem is that the web server's rewrite rules are sending any files or directories it doesn't find to MODX.

      In your .htaccess file have something like this:
      # The Friendly URLs part
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI}  !^/dev
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
      

      So if it doesn't find a file (!-f), or if it doesn't find a directory (!-d), or if it isn't "domain.com/dev..." then send it to MODX.

      Or you may be able to have an .htaccess file in the dev directory to turn off the rewrite engine altogether for that directory.
      RewriteEngine Off
        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
        • 38713
        • 91 Posts
        alexmercenary Reply #3, 10 years ago
        Thanks for the reply Susan,

        I've tried that and it doesn't seem to be working for some reason. If I create a file named dev.html and request domain.com/dev.html that works but not for a directory.
        Stumped.

        Any thoughts?

        Thanks

        UPDATE: Sorry if I add any .html file at the root and request it they work. So it's just directories that I can't get working. I need rewrites enabled in the dev directory too.
          Twitter @alexmercenary
          • 46654
          • 14 Posts
          Cant you just drop another .htaccess in the dev directory with rewrite rules associated to it specifically? Maybe i'm thinking of php.ini..
            • 38713
            • 91 Posts
            alexmercenary Reply #5, 10 years ago
            The dev directory does have it's own rewrite rules. But the MODX .htaccess is redirecting the request to that directory throwing a 404. So something in the MODX .htaccess is catching that URL segment. But I don't know what.
              Twitter @alexmercenary