I have a Revo install running on a shared hosting account. The site moderately large--about 300 pages divided into about a dozen categories. Each page is a resource; each category is a container. Pretty straightforward.
My goal is to set up a different domain which will present the information from just one of those categories. What I’d ideally like is a single MODx install and a single database providing content to two different Web sites--one of which has the entire 300 pages, and the other of which shows only the resources from a single container, with no navigation for (and no way to access) the other containers and their associated resources. (Essentially, the full site has pages on a number of different topics, and I want the new site--which has its own separate domain name, and is not a subdomain of the existing site--to present only one of those topics.)
I’ve been digging through the Revo documentation, but it’s not clear to me whether or not this can be done. Any suggestions?
That’s a tricky one. The normal way of doing multiple sites is to create separate contexts. The problem is that once you move the subset of pages to the other context, they’ll disappear from the main site.
You might be able to do it by creating a second context for the subsite and populate it with symlinks for all the resources, but I’m not sure if cross-context symlinks work or not.
Another route might be to use one context, but with an extra container full of weblinks or symlinks for the docs you want to show in the "subsite." Then, you could use a rewrite rule in .htaccess to send users who request the smaller site to that container. I would try this first, because contexts introduce a level of complexity that I’d want to avoid if possible. Note that with this scheme, users could still access the full site if they can guess the appropriate URLs unless you prevent that somehow with a snippet, plugin, or login strategy.
"You might be able to do it by creating a second context for the subsite and populate it with symlinks for all the resources, but I’m not sure if cross-context symlinks work or not."
That’s a really clever idea. I created a new Revo install on some server space I had available and gave it a try. As it turns out, when you create separate contexts, symlinks in one context that point to a resource in another context don’t work. It’s too bad; that would have been the perfect solution to my problem.
Using an .htaccess file is less ideal, because as you say it would allow users of one site to access the other if they knew (or could guess) the URLs. It looks like that might be my only option, though.
I’d love to see a future Revo version permit cross-context symlinks. Any idea if that’s a reasonable possibility?
File it as a feature @ bugs.modx.com!
-
☆ A M B ☆
- 104 Posts
It would definitely be a hack, but you could try doing this with user permissions. Create a user for each "site" then over-write some system settings for those users for values like site_url, etc. You’d need a plugin that would log these users in when they come from the right URL, but it would effectively "block" access to one site from another. I wouldn’t recommend it for more than a temporary solution, and it would probably fall apart if you actually log in users in other parts of your site(s), but theoretically it could work.
Fair warning to context users: If you have to add ssl to your contexts, don’t do it. Each domain requires its own IP for SSL’s. That is a deal killer for a system I just built...
Upgraded to 2.1.1, and I noticed a new setting in the System Settings for "Allow Forwarding Across Contexts." Don’t know if it was there in 2.0, and I can’t find any documentation for it anywhere, but it does exactly what it says on the tin. If I set it to True, I can create symlinks in one context that reference a resource in another context and it works.
It won’t allow me to use a template from the other context, which I find a bit strange, but the content is there.
....aaaaand it looks like I spoke too soon.
There appears to be a serious caching bug in Revo 2.1.1 when this option is set to "yes." If the "allow_forward_across_contexts" option is enabled, a symlink in context2 will correctly display the content from context1 exactly once. As soon as the page is refreshed, the content vanishes. Clearing the site cache allows it to work again...exactly once.
Quote from: franklinveaux at Jun 15, 2011, 04:17 PM
....aaaaand it looks like I spoke too soon.
There appears to be a serious caching bug in Revo 2.1.1 when this option is set to "yes." If the "allow_forward_across_contexts" option is enabled, a symlink in context2 will correctly display the content from context1 exactly once. As soon as the page is refreshed, the content vanishes. Clearing the site cache allows it to work again...exactly once.
Would you file that here so it doesn’t get overlooked:
http://bugs.modx.com/.
Thanks!