The .htaccess file has a line
If your MODx installation is in the web root, this works. But if it’s installed in a subdirectory, then that needs to be changed to
RewriteBase /subdirectory-name
Otherwise, when Apache does the rewriting of the requested URL, it will expect to find the rewritten URL (index.php?q=alias) in the web root, which of course will fail, since it’s actually /subdirectory-name/index.php?q=alias that it wants.