Hi
anyone ever manage to set the site_start (in system settings) to a resource id that is in a different context (as in other than the default 'web' context)? I've tried everything and to no avail. Setting my site_start value simply results in modx sending me to the modx error page (default is set to resource id #1).
Theoretically it should work, but it doesn't and I'm not sure whether to consider it a bug or am I simply misunderstanding the way contexts work.
The scenario:
Context A (web)
Context B (Russian site)
I want it such that when visting the main domain www.maindomain.com, it will go to the resource id specified in the System Settings in the site_start key. Suppose it has an ID of 54, that page is under Context B. When setting the site_start to 54, it results in an error (one which I can't get more info about because modx simply sends me to specified error page).
If anyone can help with any solutions or insight into this, I'd really appreciate it
Thanks
First, it should be a Context Setting for each front-end context, not a System Setting.
If you've done that and are still sent to the error page, it's likely that either the Context or the Resource is protected by an ACL entry and/or you're missing an ACL entry that allows access to the Context of the Resource.
-
☆ A M B ☆
- 24,524 Posts
The first thing I learned about contexts is that you have to give the "anonymous" group load, list and view for the new context. If they don't have that, then they can't even discover that the context's resources exist. It was something of a problem for me to understand; in Evo permissions are "everything is public until made private". Revo is just the opposite; everything is private and every user, including the anonymous users, must be given permissions to interact with anything.
I'm sure I still don't quite have it right, but I did manage to bumble through one multi-context setup. More practice should improve understanding in time.
@susan: I think what you're seeing is true in practice, but not in theory. In theory, everything is unprotected by default in Revo too. The fact is that if you never put your new context in any Context Access ACL entry, all its resources will be visible to everyone on the front end. Unfortunately, its resources will be hidden from users in the back end (though I've never understood why this is necessary). As soon as you create the Context Access ACL entry for that context to allow a Manager user to see the resources, the context is protected in the front end -- hence the need for the Load, List, and View ACL entry.
@tourshi: Your ACL entries should allow not-logged-in users to see resources in that context in the front end (unless you have Resource Group ACL entries that would protect them). You shouldn't have the duplicate entry shown above, however -- you should just need one. I believe they might hide the resources in that context from logged-in user, though, depending on how you've set things up.
Have you tried viewing from another browser where you're not logged in to the Manager. Previewing from the Manager leaves you in a weird state, login wise, and can confuse the issue.
Hi Bobray
I deleted the duplicate ACL entries, and there aren't any Resource Group ACL entries protecting them. I've also tried it from different browser that isn't logged in (same result).
I'm pulling my hair out :p
It should be pretty straight forward, change the site_start and it should redirect to that page--I don't see what is really causing the issue and that's another point, is there anyway for MODX to tell me what the error is exactly? (instead of merely redirecting to default error page. )
You could check the error log.
Have you also created Context settings for the other site-related values (cribbed from
http://www.belafontecode.com/modx-revolution-hosting-multiple-domains/) :
site_start – the ID of your new context’s homepage.
base_url – Set this value to “/” (no quotes) since we’re making the root of the URL our base.
http_host – Set this value to “yourseconddomain.com” (your add-on domain url)
site_url – Set this value to “
http://www.yourseconddomain.com/” (FULL domain url). Must have trailing slash.
It might also help if you posted the code you use to redirect to second context.
Hi Bob,
Really appreciate they help. Yes, I have added context related settings and no I am not using any script to redirect to second context, merely a single link to switch from one context to the other.
Oh and error log is blank.
Confusing...
Is the user clicking on a link in one context to switch to the other? If so, I think you have either call $modx->switchContext('contextName') at some point or use a full link to the second page.
How are you directing the user in the first place? Are you using a plugin or index.php with a virtual host?