Jump to content

Multi Site - Is it possible to do this with PW


DV-JF
 Share

Recommended Posts

Hi,

I'm trying to set up a multisite with following specifications:

  • 2 different URLs
  • I have to reach the backend via the two URL's (eg. http://example-firstsite.com/processwire/ and http://example-secondsite.com/processwire/) so that i can create different user / editor roles witch only get "their content"
  • I want to use the nearly same template-files on both sites
  • I want to use only one core
  • I want to share some content between the sites
  • I want to have a "child-page based database for persons" witch I can query and use on both sites with it's own url

I tried to use apeisa Plugin Multisite but had to recognize that it´s not possible to use it without having a "master-site"
 

Can you give me any advices how to set PocessWire up to comply with the requirements?

Many greets, Jens alias DV-JF.

Link to comment
Share on other sites

I'm not an expert, and probably others will have better ideas than me, but it seems like you could achieve much of this with URL redirection.

You could simply have http://example-secondsite.com/processwire/ redirect to http://example-first...om/processwire/ .

Then PW has a user system. You could set up different users and have them access specific things. (I've never used it myself but I'm pretty sure)

This way, there's only one core, AND you can "share content". 

I'm not sure if this is the best way, but you could even have different page trees in PW dedicated to the different sites. 

 

  • Like 1
Link to comment
Share on other sites

I'm not an expert, and probably others will have better ideas than me, but it seems like you could achieve much of this with URL redirection.

You could simply have http://example-secondsite.com/processwire/ redirect to http://example-first...om/processwire/ .

This sounds like a plan, but it wont help me, cause I definitely need to have two different URL's even in the PW backend. 

When I have two different page trees how would you share the content? Is there a way to have "one content" on both page-trees?

Greets

Link to comment
Share on other sites

You can have two different installs that share the same core with the first option from here. But they won't share templates as you wanted. You can't share the content of the two trees, because they would be in two different databases, but you can bootstrap on installation from inside the other by bootrapping it http://processwire.com/api/include/.

Link to comment
Share on other sites

I never used apeisa's module, but I think that's the intended behavior. You can also create two trees under "home" on one install, and play with the permissions, so that one tree is shown to some users, and one tree is shown to other users.

Link to comment
Share on other sites

Jens,

You can achieve this with the help of $config->httpHost.

For this to work, your two domains should be bound to the directory where your PW installation resides. Then, in your template, you can check which domain name is used, and serve your users relevant content.

Example:

if ($config->httpHost == "www.example.com") {
    
    echo "You are visiting example.com. Have some content of type A.";    
}
elseif ($config->httpHost == "www.example.org") {
    
    echo "Looks like you are visiting example.org. You get some content of type B.";    
    
} 

Also, to bind your users to a specific domain, you can add a field for a user profile and keep their domain name in it so you redirect your users to the right address.

  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...

You can have two different installs that share the same core with the first option from here. But they won't share templates as you wanted. You can't share the content of the two trees, because they would be in two different databases, but you can bootstrap on installation from inside the other by bootrapping it http://processwire.com/api/include/.

OK, I've to come back to this topic as things going to be serious:

I've decided to set up two sites with method #1 - http://processwire.com/api/modules/multi-site-support/ and I'm syncing the template-folders 1:1 manually.

Everything works fine for me so far, but now I want to share content between these two different sites but I don´t know how to deal this situation:

On site ONE I've created a search form witch crawls and filters specific sites based on templatefiles and outputs a list of persons. I want to integrate this list and search form into site TWO.

Now I'm wondering if I have to include the index.php (like described here: http://processwire.com/api/include/) cause site ONE and TWO are sharing the same basic installation and (I guess) the same index.php, too.

Any ideas, I'm really confused !?

Link to comment
Share on other sites

You actually can't bootstrap one PW installation from another PW installation, though the idea sounds interesting. If you've got two sites sharing the same core, but running on different databases, then the only way they can share data is by taking a web service approach (the same way you'd share data with any two sites). 

Link to comment
Share on other sites

Ryan isn't there any way of "switching the database" on the template to make the api work with one instead of another?

That sounds like an interesting idea, but that's not currently possible. When PW bootstraps, it loads several things from the database into memory, like template and field definitions, etc. When you make another database connection, you are just connecting to another database and not bootstrapping all of PW. 

  • Like 1
Link to comment
Share on other sites

I wonder if installing both sites in the same database using prefixes would work. 

e.g. s1_users, s2_users (s1,s2 are prefixes)

maybe this structure

e.g. s1_notshared, s2_notshared, shared_users (s1,s2,shared are prefixes)

Both tables are in the same database so the same db connection could access them. Then you can use a hook or code to append the current prefix. In any direction, you'll probably have to implement a solution as I don't believe this is a native solution to your problem.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By humanafterall
      Hi,
      I'm looking at how I might achieve the following with Processwire:
      A low-bandwidth version of a website, on a subdomain (eg text.mydomain.com), where the content/database is exactly the same as the top level domain, but a new set of templates is used so the site is stripped back to just very simple CSS/low quality images.
      I'm looking and trying to work out what might be best — is it multi-site from the same database? Multi-instance? API? 
      Any guidance or experience of a similar setup would be much appreciated.
       
    • By Sébastien
      Hello everyone,
      I recently started using ProcessWire and already manage to accomplish several things on my own, but I keep asking myself a lot of questions, among which the following:
      After installing a multiple sites version (first method), everything works for now as desired, but I realize that all the files seem accessible by all the domains.
      Let's say that site1.com can access the asset files, template or other ressources of site2.com folders and vice versa by specifying only and for example:
      site1.com/path_to_a_site2_folder/one_file
      or
      site2.com/path_to_a_site1_folder/one_file
      Would you know if there is a simple way to prohibit this kind of behavior in order to clearly distinguish each site and thus ensure the confidentiality and separation of content?
      I prefer to avoid the entities to be considered as a single set by crawlers and prevent access the elements belonging to each domain from another domain.
      Thanks for your help. Sébastien.
    • By iipa
      Hi everybody!
      I have been reading about Multisite, but it kinda bugs me that every topic talks about having both admin and database same for multiple sites.
      I have a project where customer tests it by adding content to the site, while I still need to do some changes here and there in code, maybe some in database. If something crashes for a while, customer can't keep testing, which is a bit problematic.
      Is there any way that I could have two separate versions of one site ("production" and development) that share the same database, but are otherwise independent? Just the thought of having to migrate database every time I want to show client something new gives me anxiety 😁
    • By sins7ven
      Hi community, I am wondering if its possible to display languages based on what host/domain has been requested.
      The use case is the following: I have one installation of PW - and within this installation I set up 5 different languages (default, english, spanish, french, dutch). Now I have 3 different domains (domainA.com, domainB.com, domainC.com) and I want to decide which languages to make available based on what domain has been navigated to. 
      For example:
      domainA.com
       - default (domainA.com)
       - english (domainA.com/en)
      domainB.com
        - default (domainB.com)
        - french (domainB.com/fr)
        - dutch (domainB.com/nl)
      domainC.com
        - default (domainC.com)
        - dutch (domainC.com/nl)
      So what I want to achieve is making only these particular languages selectable in the language switcher on the frontend. Since all pages share the same templates and overall site structure I don't see the benefits of running this installation as a multisite setup or would it be better to do so? But I assume that this would be difficult to handle since the default language might change as well. (On the french version of the page, french should be the default language and so on). Any suggestions how to accomplish that? Thanks!
    • By Peter Knight
      Hi guys
      Is it possible to have a PW site display content from another PW site?
      I've been reading about ProcessWire's Multi-site options and I don't think either is a way forward for me.
      Both PW sites are separate installs with separate databases but crucially they are on the same VPS. So I'm hoping that's a good thing.
      Basically, Site A has approx 100 reviews consisting of these fields
      Reviewer name Review Date Instead of setting up the fields onto Site B and duplicating work and creating 100 pages, I want to *somehow* get site B to use a selector to fetch the necessary content from Site A.
      In future, if I need to update the reviews, I can goto the 'source' Site A to do this.
       
×
×
  • Create New...