Jump to content

Recommended Posts

Posted

Hello, 
Option 1  doesnt really work for me https://processwire.com/api/modules/multi-site-support/ on pw 3.0.22

I have an installation. I copy the Site folder and call it site-de 
if i modyfi the index.config.php eg 

function ProcessWireHostSiteConfig() {
	return array(
		/*
		 * Some Examples (you should remove/replace them if used).
		 * Just note that the values must begin with 'site-'.
		 *
		 */
		 'de.mydomain.com' => 'site-de'
		 // 'www.mydomain.com' => 'site-mydomain',
		 // 'dev.mydomain.com' => 'site-dev',
		 // 'www.otherdomain.com' => 'site-other',

		/*
		 * Default for all others (typically /site/)
		 *
		 */
		'*' => 'site',
	);
}

but i see only blank page or error 404 " 404 page not found (no site configuration or install.php available) " whats the Problem ? Or how to handle this on pw 3.0.22

 

Thanks 

Posted

Haven't tried in PW 3.X but going by your 'no install.php' available, why do you need that again? Haven't you already installed site-de?

Posted

Okay currentky it works but dont know thats right, 

i see on de.mydomain.com one version of site 

on dev.mydomain.de the base version (other DB) of my site. 
Do i have alvays to install a new version or i can copy the site-de to site-en, site-pl ..... 
and create copys of the DB ? 

I have to login in each version seperatly ? Its only same core that the installation use ? So i can update the core an once but have uptodate the modules seperatly ? 

 

Greetz 

 

Posted (edited)

Yes, you can copy over sites. The important things are:

  1. Correct db credentials in /site/config.php
  2. Correct array entries in index.config.php
  3. Correct salt value in /site/config.php (not 100% sure but I think good if salt values are different for different sites; not necessary, but good)

Yes, logins are separate. If you want one login use 'multi-site option 2'.

Yes, same core; update once, enjoy everywhere :-) is the advantage here.

 

Edit: I am assuming that those sites being copied over have previously been installed (i.e. there is a /site/assets/installed.php)

Edited by kongondo
clarity
  • Like 1
Posted

Thaks a lot, 

is it possible to detect the land and switch to right subdomain ? Are there some Modules or Snippets what I can use ? 

 

Posted
7 hours ago, iNoize said:

Thaks a lot, 

is it possible to detect the land and switch to right subdomain ? Are there some Modules or Snippets what I can use ? 

 

 

You might use a simple code which check the HTTP_ACCEPT_LANGUAGE server variable like the following snippet :

<?php

$userLocale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);

switch ($userLocale){
    case "de": // deusth
        $session->redirect("http://de.mydomain.com");
        break;
    case "en": // english
        $session->redirect("http://en.mydomain.com");
        break;
    case "fr": // french
        $session->redirect("http://fr.mydomain.com");
        break;
    default:
        // default locale/page : english
        $session->redirect("http://en.mydomain.com");
        break;
}

 

  • Like 1
Posted

Just keep in mind to maybe also check for a cookie or something, otherwise this will prevent users from manually switching to another subdomain / language.

  • Like 2

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...