I've been trying to solve this one for much longer than I care to admit. I have four contexts. Apache points them all to the same folder on the web server, and I'm using a plugin (same code as here:
http://rtfm.modx.com/revolution/2.x/administering-your-site/contexts/using-one-gateway-plugin-to-manage-multiple-domains) to process the different domains. I also tried using the Gateway Manager plugin, but currently have that one turned off. Both plugins successfully point the different requests to the correct start pages for each context.
The start pages work just fine in all of the context. But the only context that processes friendly URLs correctly for all of the interior pages is the web context.
For all of the other contexts, the links on the respective start page are constructed correctly, such as
http://mysite.com/folder/page. The links look like they should work. But when I click on them, I'm given an Apache 404 error (not MODx 404 error).
If I manually type in something like mysite.com/index.php?q=test ("test" is the alias of one of the pages), the request works, and I see the page, but the address bar says mysite.com/index.php?q=test. It should say mysite.com/test.
If I type mysite.com/index.php?id=724, which is the same test page, the URL renders as mysite.comtest/ which doesn't work at all.
If I type the alias of a page that is not on the top level of the context -- a page that is within a folder -- using the q convention (such as mysite.com/index.php?q=level2, where "level2" is the alias of a page within a folder), I am given a 503 error: page not found. This appears to be a MODx error, because there is no Apache footer at the bottom of the message.
If I turn off friendly urls completely for either the context or for the whole system, the pages in all of the contexts render correctly, the links work, and everything seems to be fine, except that I don't have friendly URLs.
My .htaccess file consists of these lines of functional code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
In my template, I'm using a hard-coded base url: <base href="
http://mysite.com">
In my context settings for the contexts that aren't working, I specify the following:
http_host: mysite.com
site_start: 689
site_url:
http://mysite.com
base_url: /
error_page: 650
unauthorized_page: 651
It seems like I must be missing something relatively simple, but I can't figure out what it is. Why would the friendly URLs work only in the web context and nowhere else?