<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>H-Quadrat IT TechBlog &#187; multi-domain</title>
	<atom:link href="http://www.h-quadrat.com/techblog/tag/multi-domain/feed" rel="self" type="application/rss+xml" />
	<link>http://www.h-quadrat.com/techblog</link>
	<description>Web und Informationstechnologie in Motorcity Rüsselsheim</description>
	<lastBuildDate>Thu, 05 Jan 2012 20:15:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MODx Revolution multi-Domain Context Installation english</title>
		<link>http://www.h-quadrat.com/techblog/111-modx-revolution-multi-domain-context-installation-english.php</link>
		<comments>http://www.h-quadrat.com/techblog/111-modx-revolution-multi-domain-context-installation-english.php#comments</comments>
		<pubDate>Mon, 30 Nov 2009 02:27:00 +0000</pubDate>
		<dc:creator>Henning T. Heil</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Content Management System]]></category>
		<category><![CDATA[MODx]]></category>
		<category><![CDATA[MODx Content Management System]]></category>
		<category><![CDATA[MODx Revolution]]></category>
		<category><![CDATA[multi-domain]]></category>

		<guid isPermaLink="false">http://www.h-quadrat.com/techblog/?p=111</guid>
		<description><![CDATA[With the introduction of the new &#8220;Revolution&#8221; release of the MODX Content Management System the developer team has implemented native support for serving multiple domains with one installation of the MODx software. Up to date such a constellation was only possible with workarounds and those so called solutions were not always 100% bullet proof under all aspects [...]]]></description>
			<content:encoded><![CDATA[<p>With the introduction of the new &#8220;Revolution&#8221; release of the <a title="MODx Content Management System Framework" href="http://www.modxcms.com" target="_blank">MODX Content Management System</a> the developer team has implemented native support for serving multiple domains with one installation of the MODx software. Up to date such a constellation was only possible with workarounds and those so called solutions were not always 100% bullet proof under all aspects of web development.<br />
In the following I have written a multiple domain tutorial for MODx Revolution and going with that I say thank you to <a title="MODx Jason Coward opengeek" href="http://modxcms.com/about/blog/jcoward/" target="_blank">Jason Coward (opengeek)</a> who has supported my first multi-domain install and numberless other MODx topics with a lot of his &#8220;good open soucre energy&#8221;.<span id="more-111"></span></p>
<pre>Diese Anleitung gibt es auch auf <a title="MODx multi-Domain Installation Tutorial" href="http://www.h-quadrat.com/techblog/93-modx-revolution-multi-domain-context-installation.php" target="_self">Deutsch</a>.</pre>
<h3>Presumptions</h3>
<ol>
<li>This tutorial is based on the assumption that all domains that shall be served by this MODx Revolution installation are pointing to one and the same directory/the same document root on your web server, e.g. /var/www/localhost/htdocs or /var/www/localhost/modxrevomulti or a corresponding path on other operating systems.</li>
<li>This tutorial uses the domains <a title="MODx templates" href="http://www.modx-templates.com" target="_blank">modx-templates.com</a>, <a title="ffm wireless" href="http://www.ffmwireless.de/" target="_blank">ffmwireless.de</a>, <a title="MODx Content Management System multi-domain installation" href="http://www.thesearchgoeson.com/" target="_blank">thesearchgoeson.com</a> for demonstration, their usage might change in the future.</li>
<li>Versions: the first succesful multi-domain test I installed with Revolution beta-2, for this tutorial a beta-5 SVN is used. With future versions of MODx Revolution the version number should not play a role any more.</li>
<li>Furthermore I exclude the discussion of author rights between multiple contexts because I don&#8217;t need them :-) &#8211; for your project you might want to check this before you start.</li>
<li>This tutorial presumes you have a plain MODx Revolution installation ready and haven&#8217;t made any bigger changes or none at all. If not: here you can find the necessary <a title="MODx CMS download" href="http://modxcms.com/download.html" target="_blank">MODx installation files</a>.</li>
<li>I have changed the <em>System</em> &gt; <em>System Settings</em> to activate the friendly_urls and corresponding settings but don&#8217;t assume this is mandatory for a multi-domain installation.</li>
</ol>
<h3>Contexts</h3>
<p>The complete architectural redesign of MODx Revolution introduces under the keyword &#8220;contexts&#8221; the concept of encapsulating the elements of each website (or other elements) into a separate area in the MODx internal data structure &#8211; into a context.</p>
<p>After the basic installation of a MODx Revolution package the Manager looks as follows (I have added some example documents):</p>
<div id="attachment_104" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_01.jpg"><img class="size-medium wp-image-104" title="screenshot_01" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_01-500x375.jpg" alt="MODx Revolution Basisinstallation" width="500" height="375" /></a><p class="wp-caption-text">Picture 1: MODx Revolution default installation</p></div>
<p>You see the default Context <em>web</em> which is always installed with MODx and the 3 documents &#8220;Start&#8221;, &#8220;MODx Revo &#8230; Tutorial&#8221; and &#8220;Error 404 page&#8221;.</p>
<p>If you now navigate to the overview of Contexts in MODx (Menu <em>System</em> &gt; <em>Contexts</em>),</p>
<div id="attachment_105" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_02.jpg"><img class="size-medium wp-image-105" title="screenshot_02" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_02-500x375.jpg" alt="MODx Contexts view and &quot;Create contexts&quot; dialog" width="500" height="375" /></a><p class="wp-caption-text">Picture 2: MODx Contexts view and &quot;Create Context&quot; dialog</p></div>
<p>you can find 2 entries: <em>web, </em>the already mentioned default-Context for the first website and <em>mgr</em>, the MODx Manager that plays a special role and holds the MODx administrational backend.</p>
<p>To these Contexts we now add two more, one for each domain we want to serve additionally in the future. After the creation of the two additional Contexts the MODx-Manager looks like this</p>
<div id="attachment_106" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_03.jpg"><img class="size-medium wp-image-106" title="screenshot_03" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_03-500x375.jpg" alt="MODx Contexts für zusätzliche Domains hinzugefügt" width="500" height="375" /></a><p class="wp-caption-text">Picture 3: MODx Contexts for additional domains have been added</p></div>
<p>Now we furthermore add some standard documents to the Contexts, you need at least one start page/index page per domain/context and also one error page for each.<br />
Names and descriptions are not important, we will only need the document IDs for the later completion of the Contexts configuration. After adding the documents for each of your domains the document structure should look similar to this</p>
<div id="attachment_107" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_04.jpg"><img class="size-medium wp-image-107" title="screenshot_04" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_04-500x375.jpg" alt="MODx-Manager nach der Einrichtung der Standarddokumente für jeden Context/Domain" width="500" height="375" /></a><p class="wp-caption-text">Picture 4: MODx-Manager after adding the default documents for each context/domain</p></div>
<h3>Completion of the additional Contexts configuration in MODx Manager</h3>
<p>Contexts can be configured completely independent but in the first place they inherit all known website-settings from the base installation and hence we will (have to) change some of the Contexts&#8217; parameters.</p>
<p>Open the <em>Contexts</em> view again via <em>System</em> &gt; <em>Contexts</em> and what you will likely see is the view of Picture 3 above.<br />
Right-click the Context you want to edit (I start with &#8220;thesearch&#8221;) and choose &#8220;<em>Update Context</em>&#8221; from the upcoming menu. The <em>Context</em> is now opened in the editing mode and you will have to switch to the &#8220;<em>Context Settings</em>&#8221; tab, then you will see the following</p>
<div id="attachment_108" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_05.jpg"><img class="size-medium wp-image-108" title="screenshot_05" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_05-500x375.jpg" alt="MODx Context Bearbeiten Ansicht" width="500" height="375" /></a><p class="wp-caption-text">Bild 5: MODx Context editing mode</p></div>
<p>You now add, one after the other, the following configuration keys by clicking on <em>Create new</em></p>
<pre>key  |  value

http_host  |  www.thesearchgoeson.com
site_url  |  http://www.thesearchgoeson.com
base_url  |  /
site_name  |  MODxCMS TheSearchGoesOn test
site_start  |  6
error_page  |  7  [optional, aber empfehlenswert]
default_template  |  3  [optional, wenn Sie mehrere templates vorbereitet haben]</pre>
<p>Besides <em>key</em> &amp; <em>value</em> you also have to fill out the field <em>name</em> in the dialog, there you can fill in whatever seems fitting and the other fields can stay as predefined or &#8211; where you like it &#8211; can be filled with additional descriptions. The values for <em>site_start</em> and <em>error_page</em> you can see in picture 4 or according to the settings on your web page.</p>
<p>When MODx finds an already existing value for the field <em>name</em> in the shipped language files, your manually added <em>name</em> might now be shown (and this behaviour might change in the future). After all settings/keys are done the Context parameters look as follows (sorted by <em>key</em>)</p>
<div id="attachment_109" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_06.jpg"><img class="size-medium wp-image-109" title="screenshot_06" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_06-500x375.jpg" alt="MODx Context konfiguriert" width="500" height="375" /></a><p class="wp-caption-text">MODx Context configured completely</p></div>
<p>Repeat the last step for all domains/contexts you want to use, I have meanwhile also configured keys for the Context <em>ffmwireless </em>- and so we can proceed to the last step of this tutorial.</p>
<h3>Mapping of domains and contexts in the index.php file</h3>
<p>In the end follows a last simple step in the index.php file in your MODx root-directory (= thedocumentroot fo your webserver for this MODx installation), you can see the file contents here <a title="MDxCMS index.php code" href="http://pastebin.com/f6e454cf7" target="_blank">as originally shipped</a> with MODx Revolution.</p>
<p>Delete or comment line 89</p>
<pre>//$modx-&gt;initialize('web');</pre>
<p>by adding the two slashes &#8220;//&#8221; in front and add the following code-block directly below the line, of course <em>changed for your domain names and the number of domains you want to run</em> with this MODx Revolution installation</p>
<pre>/* setup for multiple domains */
switch(strtolower(MODX_HTTP_HOST)) {
   case 'www.modx-templates.com:80':
   case 'www.modx-templates.com':
      // if the http_host is modx-templates.com, switch the context to web
      $modx-&gt;initialize('web');
      break;
   case 'www.ffmwireless.de:80':
   case 'www.ffmwireless.de':
      // if the http_host is ffmwireless.de, switch the context to ffmwireless
      $modx-&gt;initialize('ffmwireless');
      break;
   case 'www.thesearchgoeson.com:80':
   case 'www.thesearchgoeson.com':
      // if the http_host is thesearchgoeson.com, switch the context to thesearch
      $modx-&gt;initialize('thesearch');
      break;
  default:
      // by default / if no other rule can be applied, load 'web' context
      $modx-&gt;initialize('web');
      break;
}</pre>
<p>After your code-block should only be the follwing lines from the original code</p>
<pre>/* execute the request handler */
if (!MODX_API_MODE) {
    $modx-&gt;handleRequest();
}</pre>
<p>the complete <a title="MODxCMS index.php for multiple domains" href="http://pastebin.com/f236a81e" target="_blank">new MODx indx.php file you can finde here</a> (lines 91 &#8211; 112 have been changed).</p>
<p>That&#8217;s it, you made it &#8211; MODx is running with multiple domains and you can apply the tutorial for even more domains/contexts or other constellations!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.h-quadrat.com/techblog/111-modx-revolution-multi-domain-context-installation-english.php/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MODx Revolution multi-Domain Context Installation</title>
		<link>http://www.h-quadrat.com/techblog/93-modx-revolution-multi-domain-context-installation.php</link>
		<comments>http://www.h-quadrat.com/techblog/93-modx-revolution-multi-domain-context-installation.php#comments</comments>
		<pubDate>Mon, 30 Nov 2009 00:15:11 +0000</pubDate>
		<dc:creator>Henning T. Heil</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Content Management System]]></category>
		<category><![CDATA[MODx]]></category>
		<category><![CDATA[MODx Content Management System]]></category>
		<category><![CDATA[MODx Revolution]]></category>
		<category><![CDATA[multi-domain]]></category>
		<category><![CDATA[webdesign rüsselsheim]]></category>

		<guid isPermaLink="false">http://www.h-quadrat.com/techblog/?p=93</guid>
		<description><![CDATA[Mit Einführung der neuen &#8220;Revolution&#8221;-Generation des MODX Content Management Systems ist es möglich, mehrere Domains mit einer Installation der Software MODx zu betreiben. Bisher war eine solche Konstellation nur mit workarounds zu erreichen und diese Lösungen waren auch nicht immer unter allen Aspekten der Web-Kunst 100% zuverlässig. Nachfolgend also eine Anleitung für MODx Revolution und [...]]]></description>
			<content:encoded><![CDATA[<p>Mit Einführung der neuen &#8220;Revolution&#8221;-Generation des <a title="MODx Content Management System Framework" href="http://www.modxcms.com" target="_blank">MODX Content Management System</a>s ist es möglich, mehrere Domains mit einer Installation der Software MODx zu betreiben. Bisher war eine solche Konstellation nur mit workarounds zu erreichen und diese Lösungen waren auch nicht immer unter allen Aspekten der Web-Kunst 100% zuverlässig.<br />
Nachfolgend also eine Anleitung für MODx Revolution und damit verbunden herzlichen Dank an <a title="MODx Jason Coward opengeek" href="http://modxcms.com/about/blog/jcoward/" target="_blank">Jason Coward (opengeek)</a>, der bei der Erstinstallation und zahllosen anderen MODx-Themen mit viel OpenSource-Energie unterstützt hat.<span id="more-93"></span></p>
<pre>This document is also available in <a title="MODx Revolution multiple domain context installation tutorial" href="http://www.h-quadrat.com/techblog/111-modx-revolution-multi-domain-context-installation-english.php" target="_self">english</a>.</pre>
<h3>Annahmen</h3>
<ol>
<li>Diese Anleitung basiert darauf, dass alle von der MODx Revolution Installation zu bedienenden Domains auf ein und das selbe Verzeichnis/den gleichen documentroot auf Ihrem webserver zeigen, z.B. /var/www/localhost/htdocs oder /var/www/localhost/modxrevomulti oder einem entsprechenden Pfad auf anderen Betriebssystemen.</li>
<li>In diesem Tutorial werden die Domains <a title="MODx templates" href="http://www.modx-templates.com" target="_blank">modx-templates.com</a>, <a title="ffm wireless" href="http://www.ffmwireless.de/" target="_blank">ffmwireless.de</a>, <a title="MODx Content Management System multi-domain installation" href="http://www.thesearchgoeson.com/" target="_blank">thesearchgoeson.com</a> testweise genutzt, deren Verwendung könnte sich zukünftig wieder einmal ändern.</li>
<li>Versionen: Den ersten erfolgreichen multi-Domain-Test hatte ich in Revolution beta-2 durchgeführt, für dieses Tutorial wird eine beta-5 SVN verwendet, die Version sollte aber zukünftig keine Rolle mehr spielen.</li>
<li>Weiterhin klammere ich die Betrachtung der Autorenrechte und deren Abgrenzung zwischen den Domains im MODx-Manager aus, weil ich sie nicht benötige :-) &#8211; für Ihr Projekt sollten Sie dies gegebenenfalls vorher prüfen.</li>
<li>Diese Einführung geht davon aus, dass Sie bereits eine MODx Revolution Installation in Betrieb genommen und keine grösseren Änderungen daran vorgenommen haben. Falls nicht: hier gibt es die benötigten <a title="MODx CMS download" href="http://modxcms.com/download.html" target="_blank">MODx-Installationsdateien</a>.</li>
<li>Ich habe in den <em>System</em> &gt; <em>System Settings</em> die friendly_urls und zugehörige Einstellungen eingeschaltet, das ist jedoch nicht zwingend.</li>
</ol>
<h3>Contexts</h3>
<p>Der komplette architekturelle Neuaufbau führt im MODx &#8220;Revolution&#8221;-release unter dem Stichwort &#8220;Contexts&#8221; das Konzept ein, jeder website &#8211; und anderen Elementen &#8211; innnerhalb der MODx-Datenstrukturen einen eigenen, gekapselten Bereich zuzuordnen &#8211; eben einen Kontext.</p>
<p>Nach der normalen Installation eines MODx Revolution Paketes sieht der Manager etwa wie folgt aus, einige Beispieldokumente habe ich bereits hinzugefügt:</p>
<div id="attachment_104" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_01.jpg"><img class="size-medium wp-image-104" title="screenshot_01" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_01-500x375.jpg" alt="MODx Revolution Basisinstallation" width="500" height="375" /></a><p class="wp-caption-text">Bild 1: MODx Revolution Basisinstallation</p></div>
<p>Sie sehen den Standard-Context <em>web</em>, den MODx immer installiert und die 3 Dokumente &#8220;Start&#8221;, &#8220;MODx Revo &#8230; Tutorial&#8221; und &#8220;Error 404 page&#8221;.</p>
<p>Betrachtet man sich nun die Übersicht der Contexts in MODx (Menu <em>System</em> &gt; <em>Contexts</em>),</p>
<div id="attachment_105" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_02.jpg"><img class="size-medium wp-image-105" title="screenshot_02" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_02-500x375.jpg" alt="MODx Contexts view and &quot;Create contexts&quot; dialog" width="500" height="375" /></a><p class="wp-caption-text">Bild2: MODx Contexts Ansicht und &quot;Create Context&quot; Dialog</p></div>
<p>so sieht man 2 Einträge: <em>web, </em>den bereits angesprochenen Standard-Context für die 1. website und <em>mgr</em>, den MODx Manager, der eine Sonderrolle einnimmt und das MODx-Verwaltungs-backend enthält.</p>
<p>Diesen Contexts fügen wir nun zwei weitere hinzu, für jede zusätzlich zu behandelnde Domain einen. Nach der Erstellung der zusätzlichen Contexts sieht es im MODx-Manager dann folgendermassen aus</p>
<div id="attachment_106" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_03.jpg"><img class="size-medium wp-image-106" title="screenshot_03" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_03-500x375.jpg" alt="MODx Contexts für zusätzliche Domains hinzugefügt" width="500" height="375" /></a><p class="wp-caption-text">Bild 3: MODx Contexts für zusätzliche Domains hinzugefügt</p></div>
<p>Fügen Sie nun den Contexts noch einige zukünftige Standarddokumente hinzu, Sie benötigen mindestens eine Startseite/Indexseite pro Domain/Context und jeweils eine Fehlerseite.<br />
Dabei sind Namen und Bezeichnungen nebensächlich, lediglich die Dokument-IDs benötigen wir später für die Komplettierung der Konfiguration der Contexts. Danach sollte es für jede Ihrer Domains in etwa so aussehen</p>
<div id="attachment_107" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_04.jpg"><img class="size-medium wp-image-107" title="screenshot_04" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_04-500x375.jpg" alt="MODx-Manager nach der Einrichtung der Standarddokumente für jeden Context/Domain" width="500" height="375" /></a><p class="wp-caption-text">Bild 4: MODx-Manager nach der Einrichtung der Standarddokumente für jeden Context/Domain</p></div>
<h3>Weitere Einrichtung der zusätzlichen Contexts im MODx Manager</h3>
<p>Contexts sind komplett unabhängig konfigurierbar, erben aber zunächst nach dem inheritance-Prinzip alle von der Basisinstallation bekannten website-Parameter und wir werden folglich einige Parameter der jeweiligen Contexts anpassen (müssen).</p>
<p>Öffnen Sie im Manager zunächst wieder über <em>System</em> &gt; <em>Contexts</em> die Ansicht der Contexts, Sie sehen dann wieder eine Ansicht entsprechend Bild 3.<br />
Klicken Sie mit der rechten Maustaste auf den zu bearbeitenden Context (ich beginne mit &#8220;thesearch&#8221;) und wählen Sie im erscheinenden Menu &#8220;<em>Update Context</em>&#8221; aus. Darauf hin erscheint der Context in der Bearbeitungsansicht und Sie müssen noch auf den Reiter &#8220;<em>Context Settings</em>&#8221; wechseln, die dann folgende Ansicht sehen Sie hier</p>
<div id="attachment_108" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_05.jpg"><img class="size-medium wp-image-108" title="screenshot_05" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_05-500x375.jpg" alt="MODx Context Bearbeiten Ansicht" width="500" height="375" /></a><p class="wp-caption-text">Bild 5: MODx Context Bearbeiten Ansicht</p></div>
<p>Sie ergänzen nun nacheinander folgende Angaben durch einen Klick auf <em>Create new</em></p>
<pre>key  |  value

http_host  |  www.thesearchgoeson.com
site_url  |  http://www.thesearchgoeson.com
base_url  |  /
site_name  |  MODxCMS TheSearchGoesOn test
site_start  |  6
error_page  |  7  [optional, aber empfehlenswert]
default_template  |  3  [optional, wenn Sie mehrere templates vorbereitet haben]</pre>
<p>Neben <em>key</em> &amp; <em>value</em> müssen Sie im Dialog auch das Feld <em>name</em> befüllen, hier setzen Sie zweckmässige Bezeichnungen ein und die anderen Felder können Sie entsprechend der Voreinstellungen im Dialog belassen oder wo angebracht mit weiteren Informationen versehen. Die Werte für <em>site_start</em> und <em>error_page</em> können Sie in Bild 4 oder entsprechend der Angaben auf Ihrer Seite ablesen.</p>
<p>Wenn MODx für den eingegebenen <em>key</em> bereits einen Wert für das Feld <em>name</em> in der mitgelieferten Sprachdatei findet, werden Ihre manuellen Angaben ggf. nicht angezeigt. Am Ende der Einstellungen sehen die Context-Parameter dann etwa wie folgt aus (sortiert nach <em>key</em>)</p>
<div id="attachment_109" class="wp-caption alignnone" style="width: 510px"><a href="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_06.jpg"><img class="size-medium wp-image-109" title="screenshot_06" src="http://www.h-quadrat.com/techblog/wp-content/uploads/screenshot_06-500x375.jpg" alt="MODx Context konfiguriert" width="500" height="375" /></a><p class="wp-caption-text">MODx Context konfiguriert</p></div>
<p>Wiederholen Sie diesen Schritt für die weiteren von Ihnen einzurichtenden Domains, ich habe den Context <em>ffmwireless</em> ebenfalls mit den entsprechenden Einstellungen versehen und wir können damit zum letzten Schritt des Tutorials übergehen.</p>
<h3>Mapping der Domains und Contexts in der Datei index.php</h3>
<p>Zuletzt noch ein einfacher Schritt in der index.php in Ihrem MODx Wurzelverzeichnis (= dem documentroot Ihres webservers für diese MODx-Installation), Sie können diese Datei hier <a title="MDxCMS index.php code" href="http://pastebin.com/f6e454cf7" target="_blank">im Originalzustand sehen</a>.</p>
<p>Löschen oder kommentieren Sie nun die Zeile 89</p>
<pre>//$modx-&gt;initialize('web');</pre>
<p>in dem Sie die beiden slashes &#8220;//&#8221; voranstellen und ergänzen Sie direkt nach dieser Zeile den folgenden code-Block, natürlich angepasst an Ihre Domainnamen und die Anzahl der von Ihrer Installation zu betreibenden Domains</p>
<pre>/* setup for multiple domains */
switch(strtolower(MODX_HTTP_HOST)) {
   case 'www.modx-templates.com:80':
   case 'www.modx-templates.com':
      // if the http_host is modx-templates.com, switch the context to web
      $modx-&gt;initialize('web');
      break;
   case 'www.ffmwireless.de:80':
   case 'www.ffmwireless.de':
      // if the http_host is ffmwireless.de, switch the context to ffmwireless
      $modx-&gt;initialize('ffmwireless');
      break;
   case 'www.thesearchgoeson.com:80':
   case 'www.thesearchgoeson.com':
      // if the http_host is thesearchgoeson.com, switch the context to thesearch
      $modx-&gt;initialize('thesearch');
      break;
  default:
      // by default / if no other rule can be applied, load 'web' context
      $modx-&gt;initialize('web');
      break;
}</pre>
<p>Nach Ihrem code-Block sollten nun noch diese Zeilen</p>
<pre>/* execute the request handler */
if (!MODX_API_MODE) {
    $modx-&gt;handleRequest();
}</pre>
<p>aus dem Originalcode stehen, die gesamte <a title="MODxCMS index.php for multiple domains" href="http://pastebin.com/f236a81e" target="_blank">neue MODx indx.php Datei können Sie hier betrachten</a> (Zeilen 91 &#8211; 112 wurden verändert).</p>
<p>Das war&#8217;s, Sie haben es geschafft &#8211; MODx läuft mit mehreren Domains und Sie können diese Vorgehensweise auch bei weiteren Domains/Contexts oder anderen Anlässen anwenden!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.h-quadrat.com/techblog/93-modx-revolution-multi-domain-context-installation.php/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

